mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-18 19:47:22 +02:00
httputil : wrap handlers for additional context (#413)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
487fc655d6
commit
b3d3159185
27 changed files with 495 additions and 463 deletions
|
@ -14,6 +14,9 @@ func NewRouter() *mux.Router {
|
|||
|
||||
// CSRFFailureHandler sets a HTTP 403 Forbidden status and writes the
|
||||
// CSRF failure reason to the response.
|
||||
func CSRFFailureHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ErrorResponse(w, r, Error("CSRF Failure", http.StatusForbidden, csrf.FailureReason(r)))
|
||||
func CSRFFailureHandler(w http.ResponseWriter, r *http.Request) error {
|
||||
if err := csrf.FailureReason(r); err != nil {
|
||||
return NewError(http.StatusBadRequest, csrf.FailureReason(r))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue