make sure setting code happen before callback in rest (#936)

This commit is contained in:
Kevin Wan 2021-08-22 09:27:20 +08:00 committed by GitHub
parent bf3ce16823
commit 9672298fa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {