Amplify API PUT/POST only sends "application/json" content-type #2647
Labels
api
bug
Something isn't working
closing soon
This issue will be closed in 7 days unless further comments are made.
REST API
Related to the API (REST) category/plugins
Before opening, please confirm:
Language and Async Model
Not applicable
Amplify Categories
REST API
Gradle script dependencies
All Versions
Environment information
All Versions
Please include any relevant guides or documentation you're referencing
No response
Describe the bug
Customers are free to pass their own
Content-Type
header into POST/PUT requests. This provided header is part of this sigv4 signature.However this line results in
application/json
being the actualContent-Type
sent to the server:amplify-android/aws-api/src/main/java/com/amplifyframework/api/aws/auth/IamRequestDecorator.java
Line 102 in f3f8caf
This will result in response failing due to signature mismatch.
Customers should be able to provide their own
Content-Type
. The fix should grab content-type from customer headers if one exists, otherwise fallback toapplication/json
then sign. The RequestBody.create method should then pass the proper content type instead of the hardcoded JSON_MEDIA_TYPE.Reproduction steps (if applicable)
No response
Code Snippet
// Put your code below this line.
Log output
amplifyconfiguration.json
No response
GraphQL Schema
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: