MCPcopy
hub / github.com/dgraph-io/dgraph / recoveryHandler

Function recoveryHandler

graphql/admin/http.go:374–385  ·  view source on GitHub ↗
(next http.Handler)

Source from the content-addressed store, hash-verified

372}
373
374func recoveryHandler(next http.Handler) http.Handler {
375
376 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
377 defer api.PanicHandler(
378 func(err error) {
379 rr := schema.ErrorResponse(err)
380 write(w, rr, strings.Contains(r.Header.Get("Accept-Encoding"), "gzip"))
381 }, "")
382
383 next.ServeHTTP(w, r)
384 })
385}
386
387// addDynamicHeaders adds any headers which are stored in the schema to the HTTP response.
388// At present, it handles following headers:

Callers 1

NewServerFunction · 0.85

Calls 5

PanicHandlerFunction · 0.92
ErrorResponseFunction · 0.92
writeFunction · 0.85
ServeHTTPMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected