Top-level handler call. It's passed a pointer to the specific method to run.
(method handlerMethod, accessPermissions []Permission, responsePermissions []Permission)
| 269 | |
| 270 | // Top-level handler call. It's passed a pointer to the specific method to run. |
| 271 | func (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 |
| 292 | func (h *handler) shouldCheckAdminRBAC() bool { |
no test coverage detected