Skip to content

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
@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