chore: update unauthorized callback calling order (#1469)
* chore: update unauthorized callback calling order * chore: add comments
This commit is contained in:
@@ -113,11 +113,13 @@ func unauthorized(w http.ResponseWriter, r *http.Request, err error, callback Un
|
||||
detailAuthLog(r, noDetailReason)
|
||||
}
|
||||
|
||||
writer.WriteHeader(http.StatusUnauthorized)
|
||||
|
||||
// let callback go first, to make sure we respond with user-defined HTTP header
|
||||
if callback != nil {
|
||||
callback(writer, r, err)
|
||||
}
|
||||
|
||||
// if user not setting HTTP header, we set header with 401
|
||||
writer.WriteHeader(http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
type guardedResponseWriter struct {
|
||||
|
||||
Reference in New Issue
Block a user