fix(platform): stop emitting content-length in HttpClientRequest.setBody#6265
fix(platform): stop emitting content-length in HttpClientRequest.setBody#6265sijie-Z wants to merge 2 commits into
Conversation
The transport layer (fetch/undici) is responsible for computing Content-Length from what it actually sends on the wire. Setting it preemptively from body.contentLength causes wire mismatches with undici 8.2+ which stopped auto-overriding caller-supplied headers. Fixes Effect-TS#6240
🦋 Changeset detectedLatest commit: 259b088 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Confirmed at One tightening before merge: a regression test in |
Type
Description
HttpClientRequest.setBodycurrently emits acontent-lengthheader frombody.contentLengthwhen building a request.This can conflict with the behavior of the underlying transport layer (
fetch/undici), which is responsible for determining the actual bytes sent on the wire and setting the correspondingContent-Lengthheader when appropriate.This change removes the automatic
content-lengthheader emission fromsetBodyand leaves content length calculation to the transport implementation.Users who need to explicitly control the header can still set it manually through request headers.
Related