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

Method invoke

rest/handler.go:271–289  ·  view source on GitHub ↗

Top-level handler call. It's passed a pointer to the specific method to run.

(method handlerMethod, accessPermissions []Permission, responsePermissions []Permission)

Source from the content-addressed store, hash-verified

269
270// Top-level handler call. It's passed a pointer to the specific method to run.
271func (h *handler) invoke(method handlerMethod, accessPermissions []Permission, responsePermissions []Permission) error {
272 if h.server.Config.API.CompressResponses == nil || *h.server.Config.API.CompressResponses {
273 var stat *base.SgwIntStat
274 if h.shouldUpdateBytesTransferredStats() {
275 stat = h.db.DbStats.Database().PublicRestBytesWritten
276 }
277 if encoded := NewEncodedResponseWriter(h.response, h.rq, stat, defaultBytesStatsReportingInterval); encoded != nil {
278 h.response = encoded
279 defer encoded.Close()
280 }
281 }
282
283 err := h.validateAndWriteHeaders(method, accessPermissions, responsePermissions)
284 if err != nil {
285 return err
286 }
287
288 return method(h) // Call the actual handler code
289}
290
291// shouldCheckAdminRBAC returns true if the request needs to check the server for permissions to run
292func (h *handler) shouldCheckAdminRBAC() bool {

Callers 1

makeHandlerWithOptionsFunction · 0.80

Calls 5

CloseMethod · 0.95
NewEncodedResponseWriterFunction · 0.85
DatabaseMethod · 0.45

Tested by

no test coverage detected