Skip to content

fix(java): Remove Content-Type from headers when request has no body#7510

Merged
jsklan merged 13 commits intomainfrom
jsklan/java-sdk-put-no-body
Jun 16, 2025
Merged

fix(java): Remove Content-Type from headers when request has no body#7510
jsklan merged 13 commits intomainfrom
jsklan/java-sdk-put-no-body

Conversation

@jsklan
Copy link
Copy Markdown
Contributor

@jsklan jsklan commented Jun 14, 2025

Description

Previously we were including the following header on all requests without a body:

{ 'Content-Type': 'application/json'}

This causes some issues for some APIs since it doesn't respect their API constraints.
Root cause was that the java sdk generator was adding a content type header whenever specific response types were specified in the request.

Changes Made

  • Removed consideration of the response type in the sendContent evaluation
  • Ensured all places the Content-Type header was added were conditional on the sendContent boolean
  • Manual file changes are limited to this file list. Remainder of changes were generated.

Testing

Ran seed test --fixture exhaustive --skip-scripts and reviewed the changes manually.

  • Unit tests added/updated
  • Manual testing completed

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 16, 2025

@jsklan
Copy link
Copy Markdown
Contributor Author

jsklan commented Jun 16, 2025

@dsinghvi Looks like these changes caused seed snapshot tests to fail. But in this case, the changes are correct per the new changes. How do I mark that the new values are expected so that these tests pass again?

@jsklan jsklan merged commit 7825505 into main Jun 16, 2025
42 of 44 checks passed
@jsklan jsklan deleted the jsklan/java-sdk-put-no-body branch June 16, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants