Diode Dan
Diode Dan

Reputation: 5151

Insomnia REST Client - Set "Content-Type" for multipart/form-data

TL;DR How can I set the Content-Type headers for each individual file/input/text in a multipart/form-data request (in Insomnia)?

I'm trying to POST to the OneNote API (HTTP description) using the Insomnia Rest Client. Per the documentation, I need to submit a multipart/form-data request with one file/text with headers:

Content-Type: text/html Content-Disposition: form-data; name=presentation

and another with the headers:

Content-Type: application/inkml+xml Content-Disposition: form-data; name=presentation-onenote-inkml

Here is a screenshot of what I am trying: headers As you can see, the API returns an error with No Content-Type leading me to believe that the Content-Type header is not set. The debug information is below: debug The POST data is hidden, which does not allow me to see the Content-Type.

Upvotes: 28

Views: 65845

Answers (3)

mipo256
mipo256

Reputation: 3214

To complete the accepted answer, just beware that as of now, there is no documented way to specify the Content-Type of the part of the multipart request in insomnia.

There are already a couple of issues for this in their GitHub source. Like this and this one.

Upvotes: 2

martoni
martoni

Reputation: 31

The "Generate Code" command may help you find the cause of the problem. The command generates a program code, which contains the essential part of the POST data.

For example:

Upvotes: 2

Diode Dan
Diode Dan

Reputation: 5151

Solution: When you use POST with the file arguments, this works. I don't know why.

solution image

Upvotes: 37

Related Questions