I need to make a call to an endpoint using Restassured with a JPEG(Image file) file as multipart/form-data(content type). In the postman, the call is working fine, but its not the case when I execute through my code below. Any help would be much appreciated
CodePudding user response:
I think you just miss the mime-type for file upload.
RequestSpecBuilder addMultiPart(String controlName, File file, String mimeType)
You just put image/jpeg
for jpeg file.
addMultiPart("file", new File(FILE_TO_UPLOAD), "image/jpeg")