Skip to content

Fix captured response prefixes across multiple writes - #21

Open
bensynapse wants to merge 1 commit into
samber:mainfrom
bensynapse:fix-response-body-prefix-cycle-0265
Open

bensynapse wants to merge 1 commit into
samber:mainfrom
bensynapse:fix-response-body-prefix-cycle-0265

Conversation

@bensynapse

Copy link
Copy Markdown

I run Live Tennis API.

When response recording reaches its size limit, a later short write truncates bytes already saved. With a four byte cap, writes "abcd" and "e" capture "ae".

Capture now stops at the limit and keeps the original prefix. The complete response and byte count stay intact. This also fixes recorded ReadFrom calls.

The regressions cover chunk boundaries and the middleware's JSON log output. Eleven checks fail before the fix.

make test, make build and go vet ./... pass on Go 1.21.13 and 1.23.4. make coverage and make lint also pass on Go 1.23.4.

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