Cómo enviar archivos en la solicitud.
public void sentFileInRequestBody() {
//insert the file path you try to send in req body form-data
File file = new File("");
//base url
RestAssured.baseURI = "";
RequestSpecification httpRequest = RestAssured.given()
//insert query params
.queryParam("key", "value")
//insert headers
.header("key", "value")
//if you send files in request body -> form-data, use this
.contentType("multipart/form-data")
.multiPart("key", file);
//Http request with base path
Response response = httpRequest.request(Method.POST, "/your path");
//print response
String responseBody = response.getBody().asPrettyString();
System.out.println(responseBody);
}
Chathumal Sangeeth