Add reproduction for HttpClientRequest issue - #6867
Conversation
🦋 Changeset detectedLatest commit: ac28d83 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
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 |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a single audit test that reproduces stale Content-Length preservation in HttpClientRequest.setBody.
HttpClientRequest.audit.test.ts— creates a POST request withbodyText("abc")(setscontent-length: "3"), replaces the body with a stream of unknown length (HttpBody.stream(Stream.empty)), and asserts thatcontent-lengthis absent from the headers. The test fails as expected, confirming the bug.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
| @@ -0,0 +1,10 @@ | |||
| import { assert, it } from "@effect/vitest" | |||
There was a problem hiding this comment.
Merge this test file with the main request tests.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the fix removes stale content-length headers in setBody, and the regression test was integrated into the main test file.
HttpClientRequest.tsfix — adds anelsebranch that callsHeaders.remove(headers, "content-length")when the replacement body has no known length, matching the existing pattern forEmpty/FormDatabodies.- Test relocation — the audit test was moved from a standalone
HttpClientRequest.audit.test.tsintoHttpClientRequest.test.tsunder adescribe("setBody")block withstrictEqualassertions, consistent with the surrounding test style. - Changeset — standard patch-level changeset documenting the fix.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|

Summary
content-lengthheader when the replacement body does not provide length metadata.Root cause
HttpClientRequest.setBodyupdatedcontent-lengthwhen the new body had a known length, but left the previous header unchanged when the new length was unknown.Validation
Closes EFF-306