MCPcopy
hub / github.com/perkeep/perkeep / serveHTTPForOp

Method serveHTTPForOp

pkg/auth/auth.go:424–430  ·  view source on GitHub ↗

serveHTTPForOp serves only if op is allowed for this request and auth mode.

(w http.ResponseWriter, r *http.Request, op Operation)

Source from the content-addressed store, hash-verified

422
423// serveHTTPForOp serves only if op is allowed for this request and auth mode.
424func (h Handler) serveHTTPForOp(w http.ResponseWriter, r *http.Request, op Operation) {
425 if Allowed(r, op) {
426 h.Handler.ServeHTTP(w, r)
427 } else {
428 SendUnauthorized(w, r)
429 }
430}
431
432// RequireAuth wraps a function with another function that enforces
433// HTTP Basic Auth and checks if the operations in op are all permitted.

Callers 1

ServeHTTPMethod · 0.95

Calls 3

AllowedFunction · 0.85
SendUnauthorizedFunction · 0.85
ServeHTTPMethod · 0.45

Tested by

no test coverage detected