0

I want to send below as a Multipart Form in API Body for a POST request:

Upload passing two attributes (KEY) with (VALUE) Send arquivo (KEY) with (file) How to do this using REST-Assured

multipart print https://ibb.co/0QQCkQv

attempts:

Response response = (Response)
given()
.relaxedHTTPSValidation()
.header("Content-Type", "multipart/form-data")
.formParam("tipo", "capital_relatorio_faturamento")
.multiPart("arquivo", file, "image/jpg")
enter code here
------------------------------
.formParam("arquivo", "image/jpg")
.multiPart("tipo", "capital_balanco_patrimonial")
.multiPart("arquivo",file)
-------------------------------
.header("Content-Type", "multipart/form-data")
.multiPart("tipo", "capital_comprovante_endereco")
.multiPart("arquivo",file)```

1 Answers1

1

Try

.multiPart("tipo", "capital_balanco_patrimonial")
.multiPart("arquivo", file, "image/jpg")

Rest-assured will automatically add content-type for these.

lucas-nguyen-17
  • 5,516
  • 2
  • 9
  • 20