mirror of
https://github.com/caddyserver/caddy.git
synced 2025-03-13 17:18:50 +01:00
requestbody: Fix ContentLength calculation after body replacement (#6896)
This commit is contained in:
parent
dccf3d8982
commit
2ac09fdb20
1 changed files with 1 additions and 1 deletions
|
@ -75,7 +75,7 @@ func (rb RequestBody) ServeHTTP(w http.ResponseWriter, r *http.Request, next cad
|
|||
repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
|
||||
replacedBody := repl.ReplaceAll(rb.Set, "")
|
||||
r.Body = io.NopCloser(strings.NewReader(replacedBody))
|
||||
r.ContentLength = int64(len(rb.Set))
|
||||
r.ContentLength = int64(len(replacedBody))
|
||||
}
|
||||
if r.Body == nil {
|
||||
return next.ServeHTTP(w, r)
|
||||
|
|
Loading…
Reference in a new issue