MCPcopy
hub / github.com/safing/portmaster / ServeHTTP

Method ServeHTTP

base/api/authentication_test.go:38–49  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

36}
37
38func (ah *testAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
39 // Check if request is as expected.
40 ar := GetAPIRequest(r)
41 switch {
42 case ar == nil:
43 http.Error(w, "ar == nil", http.StatusInternalServerError)
44 case ar.AuthToken == nil:
45 http.Error(w, "ar.AuthToken == nil", http.StatusInternalServerError)
46 default:
47 http.Error(w, "auth success", http.StatusOK)
48 }
49}
50
51func makeAuthTestPath(reading bool, p Permission) string {
52 if reading {

Callers

nothing calls this directly

Calls 2

GetAPIRequestFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected