'Sending post request to S3 with RestAssured
I want to reproduce a postman call with RestAssured. The call send some text parameters and a file parameter to upload file to S3
In rest assured I've done this :
Response response = RestAssured
.given()
.header("Content-Type","multipart/form-data")
.header("Connection","keep-alive")
.formParams(credentials) // credentials is a hashmap containing all the text params
.multiPart("file",new File("src/main/resources/media/desktop_1.webm"),"video/webm")
.post();
I'm getting this error NFOS: I/O exception (java.net.SocketException) caught when processing request to {s}->https://s3HIDDENURL: Connection reset by peer: socket write error avr. 26, 2022 3:40:29 PM org.apache.http.impl.client.DefaultHttpClient tryExecute
I've also tried to change the file from multipart to formParam like this : .formParam("file",new File("src/main/resources/media/desktop_1.webm"),"video/webm")
I've got another error Cannot serialize because cannot determine how to serialize content-type multipart/form-data
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|