Skip to content

fix(middleware): retain partially written BodyDump responses - #3211

Open
anqorithm wants to merge 1 commit into
labstack:masterfrom
anqorithm:anqorithm/fix-bodydump-partial-write
Open

anqorithm wants to merge 1 commit into
labstack:masterfrom
anqorithm:anqorithm/fix-bodydump-partial-write

Conversation

@anqorithm

Copy link
Copy Markdown

BodyDump omits successfully written response bytes when the underlying writer returns a partial count and an error. The bounded writer returns before recording the prefix, and the unlimited io.MultiWriter path stops before copying it to the dump buffer.

Use the existing dump writer for both modes and record only the accepted prefix before returning the write error. Preserve the dump limit and report io.ErrShortWrite for a short write with no error. Six regression cases cover bounded/unlimited dumps and explicit/silent write failures; the original partial-error cases fail before the fix. Full race tests, build, go vet, staticcheck, golint and diff checks pass.

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