Skip to content

Set Content-Length when the request body is set instead of via middleware - #3513

Open
Tongs2000 wants to merge 2 commits into
mainfrom
feat-inline-content-length
Open

Set Content-Length when the request body is set instead of via middleware#3513
Tongs2000 wants to merge 2 commits into
mainfrom
feat-inline-content-length

Conversation

@Tongs2000

@Tongs2000 Tongs2000 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Content-Length is now set when the request body is set, via smithy-go Request.SetStream, so the generated middleware stacks no longer register the standalone ComputeContentLength middleware.

The first commit is the codegen change (stop registering the middleware, plus a test fixup). The second commit is the regenerated output, so the large diff in generated files is expected and comes from code generation, not manual edits.

Behavior

SetStream sets the length when the body is a known length reader such as a bytes or strings reader or a seekable stream. Request compression updates the length after compressing. When the length cannot be determined, for example a non seekable stream, ContentLength is left unchanged so a user provided value is preserved.

Cross repo dependency

This depends on the smithy-go change that makes Request.SetStream set Content-Length (aws/smithy-go#694). The SDK needs to be pinned to that released version before merging.

No changelog entry is included, per the PR guidelines.

@Tongs2000
Tongs2000 marked this pull request as ready for review August 12, 2026 16:25
@Tongs2000
Tongs2000 requested a review from a team August 12, 2026 16:25
@Tongs2000
Tongs2000 force-pushed the feat-inline-content-length branch 3 times, most recently from 967b738 to 258b681 Compare August 12, 2026 22:19
Content-Length is now set when the request body is set via smithy-go
Request.SetStream, so the generated stacks no longer register the standalone
ComputeContentLength middleware.
@Tongs2000
Tongs2000 force-pushed the feat-inline-content-length branch from 258b681 to e3bba75 Compare August 12, 2026 23:46
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