Skip to content

fix: preserve absent body when copying requests - #16

Closed
Wfontesd wants to merge 1 commit into
lqhuang:mainfrom
Wfontesd:fix/copied-request-body
Closed

fix: preserve absent body when copying requests#16
Wfontesd wants to merge 1 commit into
lqhuang:mainfrom
Wfontesd:fix/copied-request-body

Conversation

@Wfontesd

@Wfontesd Wfontesd commented Sep 8, 2026

Copy link
Copy Markdown

Copying a request with HttpRequest.newBuilder(request, filter) currently replaces an absent body publisher with BodyPublishers.noBody(). A copied GET, HEAD, or DELETE therefore reports a body publisher even when the original did not.

Initialize the copied builder with the original optional body publisher. This preserves the distinction between no publisher and an explicitly supplied zero-length publisher, while retaining the existing method validation.

Tests cover GET/HEAD/DELETE without bodies, an explicit empty GET publisher, and a POST whose publisher, URI, timeout and Expect setting are preserved while headers are filtered. The initial GET regression passes on JDK 25.0.2 and fails on Native before the fix. All three final tests pass on the JDK. On Scala Native 0.5.12/Linux, all 35 tests across the new header/copy suites and existing HttpHeadersTest/HttpRequestTest suites pass with both independent fixes applied.

Fixed with the help of AI.

Would you consider US$35 via PayPal for accepting this focused fix? This is a proposed price, not an agreed bounty or a claim on the main requests-scala award. Payment details can be shared privately. This is separate from #12's mutation-after-build issue.

@lqhuang

lqhuang commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Close since it seems agent spam. Reopen only if you're not a bot.

@lqhuang lqhuang closed this Sep 8, 2026
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.

2 participants