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: Use Content-Type from specs to prevent 'The supplied content-type media type is not supported.' #34

Merged
merged 3 commits into from
Jul 13, 2023

Conversation

robvanaarle
Copy link
Contributor

@robvanaarle robvanaarle commented Jul 12, 2023

In #33 @lenvanessen found a bug regarding invalid Content-Type header: application/vnd.retailer.v10+json is used while it should be using application/vnd.retailer.v9+json. This results in the error response 'The supplied content-type media type is not supported.'

In BaseClient a constant is used as Content-Type, which means all methods use the same value for this header. With the introduction of v10 of the API this bug was introduced: v10 is only partially defined in the OpenAPI specs, so it is merged with the v9 specs. Some methods now require v9 of the Content-Type header while others require v10.

The OpenAPI specs specifies both produces and consumes. The first should be (and is) sent as Accept header, the latter as Content-Type. So in this PR the use of the constant is replaced with the consumes value from the specs.

@robvanaarle robvanaarle changed the title Fix: Use Content-Type specified in Redoc to prevent 'The supplied content-type media type is not supported.' Fix: Use Content-Type from specs to prevent 'The supplied content-type media type is not supported.' Jul 12, 2023
@lenvanessen
Copy link

@robvanaarle great! works like a charm!

@robvanaarle robvanaarle merged commit efa3ed4 into main Jul 13, 2023
12 checks passed
@robvanaarle robvanaarle deleted the use-consumes-as-content-type branch July 13, 2023 06:29
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