Hi,
I’m using RA 3.0.7 and I have issue when trying to upload file.
The code (Java) I’m using is:
given()
.header("Cookie", <cookie>).
formParam("hdnSelectedTool", "abc").
formParam("hdnIsOverride", false).
multiPart("fileToUpload", fileToUpload).
when().
post(<url>);
My problem is the server gets ‘Content-Transfer-Encoding: 8bit\n’ string as prefix for each param I pass in the request.
For example, I pass hdnSelectedTool=abc, but the server gets hdnSelectedTool= Content-Transfer-Encoding: 8bit\n abc
Did someone encounter this issue and know how to deal with it?
Thanks in advance
given()
--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
thanks!!
Response res =
given()
.headers( "Authorization", "Bearer " + jwtToken)
.contentType("application/vnd.ms-excel")
.multiPart("file", new File("testdata/sod_portfolio/FI_TRADES_20200810.csv"), "application/vnd.ms-excel")
.when()
.post(url);
ERROR:
java.lang.IllegalArgumentException: Content-Type application/vnd.ms-excel is not valid when using multiparts, it must start with "multipart/" or contain "multipart+".
Also tried the following:
String response = RestAssured.given()
.multiPart("file", new File("testdata/testMyData.csv"), "application/vnd.ms-excel" )
.when().
post(url).
then().extract().asString();
System.out.println("Response is : " + response);
But I am not able to upload successfully.
Appreciate your response if anybody has automated the upload functionality.
Thanks
given()
.headers( "Authorization", "Bearer " + jwtToken)
.contentType("application/vnd.ms-excel")
.multiPart("file", new File("testdata/myFile_20200810.csv"), "application/vnd.ms-excel")
.when()
.post(url);
Error:
java.lang.IllegalArgumentException: Content-Type application/vnd.ms-excel is not valid when using multiparty, it must start with "multipart/" or contain "multipart+".