Fix: Use Content-Type from specs to prevent 'The supplied content-type media type is not supported.' #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #33 @lenvanessen found a bug regarding invalid
Content-Type
header:application/vnd.retailer.v10+json
is used while it should be usingapplication/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 asContent-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 theContent-Type
header while others require v10.The OpenAPI specs specifies both
produces
andconsumes
. The first should be (and is) sent asAccept
header, the latter asContent-Type
. So in this PR the use of the constant is replaced with theconsumes
value from the specs.