diff --git a/rest/handler/authhandler.go b/rest/handler/authhandler.go index 16289961..14dd7e7f 100644 --- a/rest/handler/authhandler.go +++ b/rest/handler/authhandler.go @@ -112,11 +112,12 @@ func unauthorized(w http.ResponseWriter, r *http.Request, err error, callback Un } else { detailAuthLog(r, noDetailReason) } + + writer.WriteHeader(http.StatusUnauthorized) + if callback != nil { callback(writer, r, err) } - - writer.WriteHeader(http.StatusUnauthorized) } type guardedResponseWriter struct {