26

I'm trying to test my logic app API in postman but I'm having an issue with header postman automatically adding

Content-Type = multipart/form-data;

when I hover on the content-type tab seeing this "use the request body tab to control the value or remove the header"

Can anyone help me with how I can set Content-Type = application/json

enter image description here

Gaurav Joshi
  • 861
  • 1
  • 11
  • 17
  • 1
    You should just be able to untick that and manually add an header you want. – Danny Dainton Feb 14 '21 at 10:16
  • Hi Danny I tried to untick but postman automatically added when you click on send button below mentioned solution worked for me. – Gaurav Joshi Feb 15 '21 at 03:09
  • If you manually added a new `Content-Type: application/json` header, it would have used that. Going the route mentioned, would add that header too as it's matching the Content-Type to the body that you're using, for example `JSON` but you can add any Headers you like by manually typing them into a new field. – Danny Dainton Feb 15 '21 at 07:10

4 Answers4

37

Postman won't allow you to edit the headers that it auto-generates based on your drop-down selections, and Content-Type is one of these.

However it will allow you to deselect the auto-generated header and add a custom Content-Type header with any value you want. As far as the actual request is concerned, that's equivalent.

custom content type header in postman

emery
  • 8,603
  • 10
  • 44
  • 51
  • This should be the answer. I spent an hour trying to figure out what was wrong with my code. Postman wouldn't send the data to my API. Thanks. – Rutwick Gangurde Dec 19 '22 at 13:23
  • 1
    @RutwickGangurde As time goes by Postman refuses to listen to what we want (like calling other requests from a test) and instead they decide to take a page out of Google's and Microsoft's playbooks and frustrate the crap out of everybody. – Mike Cheel Jan 30 '23 at 19:40
  • 1
    @MikeCheel I have to agree with you on that. Many simple tasks are absolutely complicated or hidden so well that you cannot help but pull your hair out. – Rutwick Gangurde Feb 14 '23 at 09:21
16

Go to Body -> select raw -> Select JSON from the dropdown. It should look like the image below then set it to application/json

enter image description here

Axisnix
  • 2,822
  • 5
  • 19
  • 41
1

Also you can go to Headers --->Presets-> Manage Presets enter image description here and click on add to give your custom Header preset

custom header details

now you can see your custom Header , select to use it enter image description here

-1

Taking the example of the auto-generated Cookie header, if you would like to get rid of it, just click on the blue Cookies text (top-right), and unselect all the unwanted cookies, and the cookie header will be modified accordinaly

enter image description here

Ikbel
  • 1,817
  • 1
  • 17
  • 30