Showing results for 
Search instead for 
Did you mean: 

Unable to set content type to application/json for a 'metadata' key in a multipart/form-data request

New Member

Unable to set content type to application/json for a 'metadata' key in a multipart/form-data request

I have a multi-part POST request with two parts, a file and json metadata. I am able to  add "file" part and set the content-type through the attachment, but I am not able to set the content-type of the "json" 'metadata' part to "application/json".

Community Hero


Im unsure i can help as ive never had a multipart REQUEST before....ive only had to deal with multipart RESPONSES.
However if you explain more people might be able to help.
Once you add the file, what is the type set as?
Have you already set the type as multipart before you attach the file?
You can only have one 'type' set in a single request as far as i was aware, so can you provide the http headers of a multipart POST request with a json file attachment and embedded json payload? Your technical requirements should define the requests http headers and i doubt youd have multiple Content-type headers in a request, so i dont think you actually need to set the type application/json....perhaps you have the application/json set after the multipart portion of the type (either comma or semi colon separated which ive seen on responses).

Essentially we need to know thr http headers of a successful request and work backwards to define what you need....hence the reason im suggesting checking your functional requirements.

Nice one,

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
Community Manager

Thank you Richie!


@DEOKAS were you able to solve this? If not, please share more details with us that Richie is asking for🙂

Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Get a full Raw JMS request


Compare an expected JSON value and actual response in Events


Fetch value/data from JSON response using Groovy Script

See replies!

Get data from Petstore and add it to Excel sheets

Top Kudoed Authors