Forum Discussion

rasierapparat's avatar
rasierapparat
New Contributor
5 months ago
Solved

How to set different Content-Types in multipart/form-data POST Request?

I have a REST API, that I can curl correctly, but I can not get it done in ReadyApi.
I have to upload a picture and a json string, which has the content-type "type=application/json":

curl -X 'POST' 'http:/localhost:12345/rest/add' -H 'Content-Type: multipart/form-data' -F 'picture=@/home/my.jpg' -F 'criteria={"personId":"string"};type=application/json'

I ticked "Post QueryString" and selected multipart/form-data. When I look up in the RAW tab, I see, that for criteria no content-type is set. 

The error message in ReadyApi says:
Content type 'application/octet-stream' not supported

It is necessary for me to set the content-type of my criteria JSON Object to "application/json". Otherwise I will get this error. 

I am on ReadyApi 3.45. Does anyone have a clue, how to solve the problem?

  • I  don't know, if it is the only solution, but I figured out, that you can attach the json as a *.json file and configure the content type in the attachements tab. 

    I really think, this needs improvement from Smartbear. Its very underwhelming to solve such basic config by such a workaround... 

1 Reply

  • I  don't know, if it is the only solution, but I figured out, that you can attach the json as a *.json file and configure the content type in the attachements tab. 

    I really think, this needs improvement from Smartbear. Its very underwhelming to solve such basic config by such a workaround...