Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set content-length header if body has known length #96

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

czechboy0
Copy link
Contributor

Motivation

A surprising oversight, we were never setting the content-length header when sending out a known-length body.

Some transports might be already doing this, but this change makes things more consistent.

Modifications

Add the content-length header when setting a body and we know the length from the HTTPBody.

Result

More consistent experience.

Test Plan

Adapted unit tests.

@czechboy0 czechboy0 enabled auto-merge (squash) January 18, 2024 17:21
@simonjbeaumont simonjbeaumont changed the title Set content length in request/response bodies Set content-length in request/response bodies if known Jan 18, 2024
@czechboy0 czechboy0 merged commit 76951d7 into apple:main Jan 18, 2024
8 checks passed
@czechboy0 czechboy0 deleted the hd-set-content-length branch January 18, 2024 18:03
@czechboy0 czechboy0 added the 🔨 semver/patch No public API change. label Jan 18, 2024
@czechboy0 czechboy0 changed the title Set content-length in request/response bodies if known Set content-length for request/response bodies if known Jan 18, 2024
@czechboy0 czechboy0 changed the title Set content-length for request/response bodies if known Set content-length header if body has known length Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants