diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2022-03-11 12:34:55 -0700 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2022-03-11 12:34:55 -0700 |
commit | 3d616e8c6d65e5617f5a918d72fb1514c9c7144e (patch) | |
tree | c9d4625edc176dae528faf7cfebdd107089c4397 /modules/caddyhttp/server.go | |
parent | b82e22b459b9f81278810dc32916ca270efa888c (diff) |
requestbody: Return HTTP 413 (fix #4558)
Diffstat (limited to 'modules/caddyhttp/server.go')
-rw-r--r-- | modules/caddyhttp/server.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go index 3d21184..6ab77df 100644 --- a/modules/caddyhttp/server.go +++ b/modules/caddyhttp/server.go @@ -17,6 +17,7 @@ package caddyhttp import ( "context" "encoding/json" + "errors" "fmt" "net" "net/http" @@ -600,7 +601,8 @@ func PrepareRequest(r *http.Request, repl *caddy.Replacer, w http.ResponseWriter // If err is a HandlerError, the returned values will // have richer information. func errLogValues(err error) (status int, msg string, fields []zapcore.Field) { - if handlerErr, ok := err.(HandlerError); ok { + var handlerErr HandlerError + if errors.As(err, &handlerErr) { status = handlerErr.StatusCode if handlerErr.Err == nil { msg = err.Error() |