I'm testing API using rest assured , programming language is JAVA, trying to send an image , but nothing is being sent;
I have following code
@Test
public void uploadFile() {
File testUploadFile = new File("C:\Users\######\Downloads\38250987.jpeg");
RestAssured.baseURI = "http://localhost:8080";
Response response = given()
.multiPart(testUploadFile)
.when().
post("/api/product/zOPePEpj/file");
System.out.println(response.getStatusCode());
System.out.println(response.asString());
}
Actual Response Body is
{
"productImage": {
"id": null,
"productId": null,
"path": null,
"pathSmall": null,
"pathMedium": null,
"pathLarge": null,
"name": null,
"description": null,
"isMainImage": false,
"translations": [
]
},
"error": null,
"errorCode": 0
}
Expected Response Body is
{
"productImage": {
"id": "Kdl2V4lX",
"productId": "zOPePEpj",
"path": "https://bookitdev.s3.amazonaws.com/3831/images/1624_6b6e64b15d9b49f7bc78a9223c4c49cb_original",
"pathSmall": "https://bookitdev.s3.amazonaws.com/3831/images/1624_0e1fa879180b4916961867d32347f646_small",
"pathMedium": "https://bookitdev.s3.amazonaws.com/3831/images/1624_b06c93a11b20408db2d9e4eff6e2c13b_medium",
"pathLarge": "https://bookitdev.s3.amazonaws.com/3831/images/1624_1b21a3e825af41b39cfffacfeef7e054_large",
"name": null,
"description": null,
"isMainImage": false,
"translations": []
},
"error": null,
"errorCode": 0
}
Please help me to resolve this issue , thanks in advance