Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(java): Add accept header if endpoint has errors #5848

Merged
merged 7 commits into from
Feb 3, 2025

Conversation

ajgateno
Copy link
Member

@ajgateno ajgateno commented Feb 3, 2025

If an endpoint has errors, we need to pass in an accept header for application/json. In the future we'll want to delegate determining the content type to the IR but for now it's okay to have this here to get around customer issues.

@ajgateno ajgateno requested a review from dsinghvi as a code owner February 3, 2025 21:02
.url(httpUrl)
.method("DELETE", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success!


Set<String> contentTypes = new HashSet<>();

// TODO: We'll need to get error content types from the IR once they're available.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline - we can actually model this in a way where the httpEndpoint has an accept property that represents the set of Accept header values that should be sent in the request. Same idea that you're capturing here, just slightly different implementation.

@ajgateno ajgateno merged commit 7328091 into main Feb 3, 2025
53 of 54 checks passed
@ajgateno ajgateno deleted the alberto/add-accept-header-if-endpoint-has-errors branch February 3, 2025 22:10
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.

2 participants