Contributions
Re: How to set content type for multipart/form-data part?
I have downloaded and installed 2.7.0, and the behavior is the same. I need a way to explicitly set the content-type of each form part, and then it should work beautifully!5 years agoPlace ReadyAPI QuestionsReadyAPI Questions8.8KViews0likes3CommentsHow to set content type for multipart/form-data part?
I have a multi-part request with two parts, a file and json metadata. The "file" part I can set the content-type through the attachment, but the "json" part seems to be defaulting to application/octet-stream which causes a 415. POST http://localhost:9080/foo HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: multipart/form-data; boundary="----=_Part_16_1749562154.1557927365085" MIME-Version: 1.0 Content-Length: 53766 Host: localhost:9080 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_181) ------=_Part_16_1749562154.1557927365085 Content-Disposition: form-data; name="json" { "foo" : "bar", "foo1" : "bar1" } ------=_Part_16_1749562154.1557927365085 Content-Type: image/jpeg Content-Transfer-Encoding: binary Content-Disposition: form-data; name="file"; filename="royal flush.jpg" ... This causes a 415Content type 'application/octet-stream' not supported. Here is a snippet form the request (through Postman) which works: Content-Disposition: form-data; name="json" Content-Type: application/json Content-Length: 608 { "foo" : "bar", "foo1" : "bar1" } --B7pQWGrOXLWmnqGJ6JvxJJWBMoXDNZn2H Content-Disposition: form-data; name="file" Content-Type: image/jpeg Content-Length: 53275 ... When I change the content-type of the json part to application/octet-stream in Postman, I can reproduce the 415. So it seems if there is a way in ReadyAPI to set the content-type to application/json, I can POST successfully. But I do not see any options in ReadyAPI to do so. Thanks for any help in advance! Gene.5 years agoPlace ReadyAPI QuestionsReadyAPI Questions8.9KViews0likes6Comments