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

Function makeHandlerWithOptions

rest/handler.go:127–138  ·  view source on GitHub ↗

makeHandlerWithOptions creates an http.Handler that will run a handler with the given method handlerOptions

(server *ServerContext, privs handlerPrivs, accessPermissions []Permission, responsePermissions []Permission, method handlerMethod, options handlerOptions)

Source from the content-addressed store, hash-verified

125
126// makeHandlerWithOptions creates an http.Handler that will run a handler with the given method handlerOptions
127func makeHandlerWithOptions(server *ServerContext, privs handlerPrivs, accessPermissions []Permission, responsePermissions []Permission, method handlerMethod, options handlerOptions) http.Handler {
128 return http.HandlerFunc(func(r http.ResponseWriter, rq *http.Request) {
129 serverType := getCtxServerType(rq.Context())
130 h := newHandler(server, privs, serverType, r, rq, options)
131 err := h.invoke(method, accessPermissions, responsePermissions)
132 h.writeError(err)
133 if !options.skipLogDuration {
134 h.logDuration(true)
135 }
136 h.reportDbStats()
137 })
138}
139
140// makeHandler creates an http.Handler that will run a handler with the given method
141func makeHandler(server *ServerContext, privs handlerPrivs, accessPermissions []Permission, responsePermissions []Permission, method handlerMethod) http.Handler {

Callers 7

makeHandlerFunction · 0.85
makeSilentHandlerFunction · 0.85
makeOfflineHandlerFunction · 0.85
createCommonRouterFunction · 0.85
CreateAdminRouterFunction · 0.85

Calls 7

getCtxServerTypeFunction · 0.85
newHandlerFunction · 0.85
invokeMethod · 0.80
writeErrorMethod · 0.80
logDurationMethod · 0.80
reportDbStatsMethod · 0.80
ContextMethod · 0.65

Tested by

no test coverage detected