I need to send a POST request with binary data with content-type=application/octet-stream. I added the header manually, however Postman adds encoding into the header, so my application receives a request with content-type=application/octet-stream;charset=UTF-8.
How do I prevent adding the charset into the content-type?
I’m using Postman desktop app v10.19.7.
Great question, here’s how you can work around this:
Disable Automatic Headers: Postman has a setting that automatically sends certain headers with requests. To ensure that you have complete control over the headers being sent:
Open the Postman app.
Navigate to the settings (usually represented by a gear icon on the top right corner).
Under the “General” tab, find the setting for “Header auto-add”.
Make sure the option for automatically adding headers is turned off.
Manual Headers: After ensuring the above, manually add your desired headers to your request without the charset. Specifically, you’d add Content-Type: application/octet-stream.
Check Pre-request Script: Ensure that there are no pre-request scripts in the collection or request level that might be modifying headers.
Update: Though you’re using a relatively recent version of Postman (v10.19.7), always consider checking for updates. Occasionally, certain behaviors might be affected by bugs that are fixed in newer versions.
If you’ve done the above and you’re still facing the issue, it might be a more specific issue with your setup or a potential bug. In that case, please provide more details about your setup and the exact steps you’re taking, and we can further investigate.