Skip to content

fix: Fix response body corruption on retry by rewinding after truncate#336

Merged
richardwang1124 merged 3 commits into
decaffrom
fix/response-reset
May 26, 2026
Merged

fix: Fix response body corruption on retry by rewinding after truncate#336
richardwang1124 merged 3 commits into
decaffrom
fix/response-reset

Conversation

@richardwang1124
Copy link
Copy Markdown
Contributor

Http::Response#reset calls truncate(0) to clear the body between retry attempts, but does not reset the position pointer. When the retry response is written, StringIO pads the gap from position 0 to the stale pointer with null bytes, corrupting the body and resulting in Smithy::Xml::ParseError. This PR calls rewind after truncate in the reset method to correctly reset the pointer.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@richardwang1124 richardwang1124 merged commit 08fc253 into decaf May 26, 2026
21 checks passed
@richardwang1124 richardwang1124 deleted the fix/response-reset branch May 26, 2026 21:11
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.

3 participants