liuedx / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

How to set additional headers and content type to multiPart section? #400

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
I'm looking for a way to add additional headers and content-type to multipart 
section(according to my Request Payload), for example I would like to be able 
to add 

Content-Disposition: form-data; name="file"; filename="pincode_master_data.csv"
Content-Type: text/csv

When i tried Using :   given().multiPart("file",new 
File("/home/ravi/Downloads/pincode_master_data.csv")).expect().statuscode("200")
.when().post("/");

I got an error: That status code is 400

If i want to make use of MultiPartSpecBuilder, please let me know, how i need 
to use it.

What is the expected output? What do you see instead?
Without providing headers/content-type to the multipart, the Rest API i am 
trying to invoke does not work. It does not upload the excel file to the server 
if multipart headers/content-type are not provided.

What version of the product are you using? On what operating system?
I am using latest version of Rest Assured library (rest-assured-2.4.1.jar) on 
Ubuntu OS.

Please provide any additional information below.

If normally i set the header/content-type to the request then it will just be 
added to the request and not to a particular multi-part section.
Please look closely into the issue as it is a basic requirement.

Original issue reported on code.google.com by ravithej...@gmail.com on 6 May 2015 at 5:39

GoogleCodeExporter commented 8 years ago
I don't think it's supported. Perhaps we can extend the MultiPartSpecBuilder 
with these features? Would you like to help out with the implementation?

Original comment by johan.ha...@gmail.com on 7 May 2015 at 6:01

GoogleCodeExporter commented 8 years ago
Can some provide the details on how to fix this issue??

Original comment by satyanag...@gmail.com on 21 Jun 2015 at 2:41