(next http.Handler)
| 372 | } |
| 373 | |
| 374 | func 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: |
no test coverage detected