Skip to content

Commit 6e40bd8

Browse files
committed
🐛 fix: respect Immutable config for Body()
1 parent 8c84b0f commit 6e40bd8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ctx.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,11 @@ func (c *Ctx) Body() []byte {
340340
// rule defined at: https://www.rfc-editor.org/rfc/rfc9110#section-8.4-5
341341
encodingOrder = getSplicedStrList(headerEncoding, encodingOrder)
342342
if len(encodingOrder) == 0 {
343-
return c.fasthttp.Request.Body()
343+
body = c.fasthttp.Request.Body()
344+
if c.app.config.Immutable {
345+
return utils.CopyBytes(body)
346+
}
347+
return body
344348
}
345349

346350
var decodesRealized uint8

0 commit comments

Comments
 (0)