Skip to content

fix(middleware): preserve request bodies beyond the dump limit - #3105

Open
jakezwang wants to merge 1 commit into
labstack:masterfrom
jakezwang:fix/body-dump-preserve-request
Open

jakezwang wants to merge 1 commit into
labstack:masterfrom
jakezwang:fix/body-dump-preserve-request

Conversation

@jakezwang

Copy link
Copy Markdown

MaxRequestBytes limits the request data captured by BodyDump, but the middleware also drains and discards everything after that limit. As a result, the next handler receives a truncated request body, even though Content-Length still describes the full request.

Replay the captured prefix followed by the unread body, and forward Close to the original body. The dump remains bounded. Tests cover full delivery beyond the limit, errors while reading the remainder, and body ownership.

Validation: go test -race ./..., go vet ./....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant