0

This is my code to rest my api to upload file

given().auth().preemptive().basic("*****","****").contentType("multipart/form-data").multiPart("type", "SAMPLE_XML").
multiPart("preview_file",new File("C://hello.xml")).
multiPart("connector_id", "MTUyMjMyNTU0NTMwNA").
when().post(Endpoint.FILE_CONTEXT_UPLOAD).

My API has a validation where it checks the file extension .xml when this request is made.For the above request my api doesnot receive .xml file extension and so it gives out 400 error

FYI the same request works fine using Postman

1 Answers1

0

Replace contentType to ("multipart/related;boundary=*****").

Bugs
  • 4,491
  • 9
  • 32
  • 41
QualityMatters
  • 895
  • 11
  • 31