MCPcopy Index your code
hub / github.com/bettercap/bettercap / setAuthFailed

Method setAuthFailed

modules/api_rest/api_rest_controller.go:33–39  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

31}
32
33func (mod *RestAPI) setAuthFailed(w http.ResponseWriter, r *http.Request) {
34 mod.Warning("Unauthorized authentication attempt from %s to %s", r.RemoteAddr, r.URL.String())
35
36 w.Header().Set("WWW-Authenticate", `Basic realm="auth"`)
37 w.WriteHeader(401)
38 w.Write([]byte("Unauthorized"))
39}
40
41func (mod *RestAPI) toJSON(w http.ResponseWriter, o interface{}) {
42 w.Header().Set("Content-Type", "application/json")

Callers 3

sessionRouteMethod · 0.95
eventsRouteMethod · 0.95
fileRouteMethod · 0.95

Calls 6

HeaderMethod · 0.80
WriteHeaderMethod · 0.80
WarningMethod · 0.45
StringMethod · 0.45
SetMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected