Fix RecordingClient request body recording for non‑streaming bodies#4496
Open
signadou wants to merge 4 commits intosmithy-lang:mainfrom
Open
Conversation
landonxjames
requested changes
Jan 27, 2026
Contributor
landonxjames
left a comment
There was a problem hiding this comment.
This generally looks good to me. There is one CI failure related to rustfmt issues, tried to fix it myself, but I don't seem to have permissions to push to your branch. Can approve once that is fixed. Note you'll also need to bump the patch number in aws-smithy-http-client/Cargo.toml since that is going to fail a later check we run.
41b0456 to
1654879
Compare
This fixes a bug in `RecordingClient` where recording request bodies could corrupt real HTTP requests. For non‑streaming request bodies (where `SdkBody::bytes()` is available), we now buffer the bytes, record them, and rebuild the request body from the buffered data instead of swapping in a channel‑based streaming body. This avoids timing issues that can break HTTP/2 framing and cause 400 responses from ELB. Also preserves size hints on channel bodies by carrying over the original content length, keeping body metadata consistent with `Content-Length`.
1654879 to
819f9d9
Compare
Author
|
@landonxjames Thank you for reviewing! I think you're not able to push because I forked this repo into the |
…or-non-streaming-bodies-012426
…or-non-streaming-bodies-012426
…or-non-streaming-bodies-012426
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
aws_smithy_http_client::test_util::dvr::RecordingClientcan cause real AWS SDK requests with non-streaming request bodies to fail (observed as400 Bad Requestfromawselb/2.0). The same request succeeds when using the standard client withoutRecordingClient.Closes #4495
Description
For non‑streaming request bodies (where
SdkBody::bytes()is available), we now buffer the bytes, record them, and rebuild the request body from the buffered data instead of swapping in a channel‑based streaming body. This avoids timing issues that can break HTTP/2 framing and cause 400 responses from ELB.Also preserves size hints on channel bodies by carrying over the original content length, keeping body metadata consistent with
Content-Length.Note: This change is limited to the DVR test utility (
aws-smithy-http-clienttest_util::dvr) and does not affect default/prod HTTP clients.Testing
cargo test -p aws-smithy-http-client --features "test-util,legacy-rustls-ring" dvrinsiderust-runtimeand confirmed the tests still pass.Checklist
.changelogdirectory, specifying "client," "server," or both in theapplies_tokey.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.