MCPcopy Create free account
hub / github.com/dinofizz/diskplayer / ServeHTTP

Method ServeHTTP

server.go:149–161  ·  view source on GitHub ↗

An implementation of the Handler ServeHTTP function for the CallbackHandler struct.

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

Source from the content-addressed store, hash-verified

147
148// An implementation of the Handler ServeHTTP function for the CallbackHandler struct.
149func (h CallbackHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
150 t, err := h.auth.Token(STATE_IDENTIFIER, r)
151 if err != nil {
152 http.Error(w, "Couldn't get token", http.StatusForbidden)
153 log.Fatal(err)
154 }
155 if st := r.FormValue("state"); st != STATE_IDENTIFIER {
156 http.NotFound(w, r)
157 log.Fatalf("State mismatch: %s != %s\n", st, STATE_IDENTIFIER)
158 }
159
160 h.ch <- t
161}

Callers 1

TestIndexHandlerFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestIndexHandlerFunction · 0.64