I am trying to upload csv file using rest assured multipart upload method. In swagger API documentation, request body is like below for multipart csv upload.
{
"file":"string"
}
My code is like this.
String file = "src/resources/ccp/csvs/sample.csv"
responsePost = given()
.multiPart("file", new File(file), "text/csv" )
// .header("Content-type", "application/json")
.and()
.when()
.post(url)
.then()
.extract().response();
This is working in IntelliJ idea without any issue. However when I package the code into a jar using maven and run it, It returns fileNotFound exception.
As I saw, the only solution is to use java file inputstream, but since swagger says to use a file, it is impossible to use input stream, isn't it?
Is there another way to handle this issue?