Reputation: 21
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)```
Upvotes: 0
Views: 574
Reputation: 5917
Try
.multiPart("tipo", "capital_balanco_patrimonial")
.multiPart("arquivo", file, "image/jpg")
Rest-assured will automatically add content-type for these.
Upvotes: 1