I am trying to pass the following PUT request but I am getting 415 instead of 200. The request contains Form data and is passing in Postman but failing in Rest assured.
ValidatableResponse response = given().header("Authorization", token)
.header("Content-type", "application/json")
.contentType("multipart/form-data")
.multiPart("indexCalendarDateOverrideRequest", "{\n" +
" \"comments\": \"Test\",\n" +
" \"indexCalendarDateOverrideMap\": {\n" +
" \"CUTOFF_CAL\": [\n" +
" {\n" +
" \"calendarDate\": \"2024-02-28\",\n" +
" \"isBusinessDay\": true,\n" +
" \"isMonthEndBusinessDay\": false,\n" +
" \"isHoliday\": false,\n" +
" \"isWeekend\": false,\n" +
" }\n" +
" ]\n" +
" }\n" +
"}\n")
.multiPart("files", "[]").log().all()
.put(EndPoint.UPDATE_CALENDAR_DAYS).then().log().all();
response.assertThat().statusCode(200);
The postman request cURL I am trying to automate is as follows
curl --location --request PUT 'https://calculation-stg.us-west-2.mi4cd87.easn.mo.com/mat-data/index-cal/dates/update/days' \
--header 'accept: */*' \
--header 'Authorization: Bearer token' \
--form 'indexCalendarDateOverrideRequest="{
\"comments\": \"Test\",
\"indexCalendarDateOverrideMap\": {
\"CUTOFF_CAL\": [
{
\"calendarDate\": \"2024-02-22\",
\"isBusinessDay\": true,
\"isMonthEndBusinessDay\": false,
\"isHoliday\": false,
\"isWeekend\": false,
\"holiday\": false,
\"weekend\": false,
\"businessDay\": true,
\"monthEndBusinessDay\": false
}
]
}
}
";type=application/json' \
--form 'files="[]";type=multipart/form-data'