Shaq
Shaq•4h ago

Duplication of Content-Type when trying to send a API POST request

Hi noticed some weird functionality that I have never seen before and honestly is extremely confusing to me. Not sure if it is a features on not so I thought, I'd mention it here When trying to send an POST request with the Content-Type explicitly mentioned as application/json and having the body raw JSON I get an error saying 'application/JSON,application/JSON is not supported by this resource' After a few tests I noticed that it was automatically adding application/JSON as the content type and keeping the value empty fixed the issue and let me proceed with the POST request and 0 errors. Could anyone offer any insight as to why this happens or if it is a bug because I would have to immediately make these changes for all my clients accordingly
No description
No description
1 Reply
Tico | Voiceflow Assistant
Hey there! šŸ‘‹
This is expected behaviour of the API Step, not a bug: • When the request body is set to Raw → JSON Voiceflow automatically adds the header
Content-Type: application/json
Content-Type: application/json
to the outgoing call. • If you also add a Content-Type row in the Headers table, the request is sent with two values. Most servers concatenate them and you end up with:
application/json,application/json
application/json,application/json
which many endpoints (including the one you’re calling) reject. āœ… Fix: simply delete the manual header (or leave the value blank). Voiceflow will continue to send the correct header for you. šŸ”„ Only add your own Content-Type header when you need something other than application/json (e.g. application/x-www-form-urlencoded, multipart/form-data, etc.) and make sure the body format matches. That’s all you need—no changes are required to clients other than removing the duplicated header.
Docs for reference: Headers, Body & Parameters section of the API Step → https://docs.voiceflow.com
Voiceflow
Welcome to Voiceflow's docs
Build, manage, and deliver chat and voice agents for customer support and beyond.

Did you find this page helpful?