fix: add interceptors for console (#255)

* add interceptors for console

* add interceptors for console to env.json
This commit is contained in:
Livio Amstutz
2020-06-22 13:17:29 +02:00
committed by GitHub
parent 66cca48b62
commit f68a5e63b5
4 changed files with 81 additions and 32 deletions

View File

@@ -48,7 +48,16 @@ func (h *headers) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var err error
nonce, err = generateNonce(h.nonceLength)
if err != nil {
h.errorHandler(err).ServeHTTP(w, r)
errorHandler := h.errorHandler
if errorHandler == nil {
errorHandler = func(err error) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
})
}
}
errorHandler(err).ServeHTTP(w, r)
return
}
r = saveContext(r, nonceKey, nonce)