MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / newHandler

Function newHandler

rest/handler.go:186–207  ·  view source on GitHub ↗
(server *ServerContext, privs handlerPrivs, serverType serverType, r http.ResponseWriter, rq *http.Request, options handlerOptions)

Source from the content-addressed store, hash-verified

184}
185
186func newHandler(server *ServerContext, privs handlerPrivs, serverType serverType, r http.ResponseWriter, rq *http.Request, options handlerOptions) *handler {
187 h := &handler{
188 server: server,
189 privs: privs,
190 rq: rq,
191 response: NewNonCountedResponseWriter(r),
192 status: http.StatusOK,
193 serialNumber: atomic.AddUint64(&lastSerialNum, 1),
194 startTime: time.Now(),
195 runOffline: options.runOffline,
196 allowNilDBContext: options.allowNilDBContext,
197 authScopeFunc: options.authScopeFunc,
198 httpLogLevel: options.httpLogLevel,
199 serverType: serverType,
200 sgcollect: options.sgcollect,
201 }
202
203 // initialize h.rqCtx
204 _ = h.ctx()
205
206 return h
207}
208
209// ctx returns the request-scoped context for logging/cancellation.
210func (h *handler) ctx() context.Context {

Callers 3

makeHandlerWithOptionsFunction · 0.85
TestShouldCheckAdminRBACFunction · 0.85
wrapRouterFunction · 0.85

Calls 2

ctxMethod · 0.95

Tested by 1

TestShouldCheckAdminRBACFunction · 0.68