Ask a Question

Is it possible to remove Content-Type in a POST request.

SOLVED
thisIsTrue
Visitor

Is it possible to remove Content-Type in a POST request.

Hello Community.

 

I'm trying to test a REST endpoint where we have a rule that the header "Content-Type" is not mandatory. So I'm setting up some tests for this case, but I can't remove the "Content-Type" header for a POST request.

How do you send a POST request without the header "Content-Type"? (is it even possible to remove)

Thanks in advance. 

1 REPLY 1
richie
Community Hero

Hey @thisIsTrue 

 

Yep you can do this - the easy way is to blank out the MediaType dropdown on your request.

 

The MediaType combo box (combo box = editable dropdown) on your request config is what defines the Content-Type header on your request.  If you have a POST with a json payload, then your MediaType combo box is likely set as 'application/json' (although it could be other values).

 

If you just delete the value from the MediaType combo box and resubmit your POST, you'll see the Content-Type header is no longer present in the request

 

Cheers,

 

Rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
cancel
Showing results for 
Search instead for 
Did you mean: