Unable to set Content-Type in API requests if a body is present #14092
Labels
API
Related to REST API issues
feature-request
Request a new feature
VP
Version parity issues between v5 and v6
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
REST API
Amplify Version
v6
Amplify Categories
api
Backend
Other
Environment information
Describe the bug
If there is a body present in any rest api request, the Content-Type header is set to 'application/json; charset=UTF-8' regardless of what is specified in the options.headers object when constructing the request.
This issue was not present in Amplify v5 as I only noticed this after upgrading.
I can see the code doing this in the amplify codebase in api-rest/src/utils/resolveHeaders.ts.
Expected behavior
If specifying a Content-Type header while creating a request, I would expect that header to be unchanged when making the request.
Reproduction steps
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: