So I created a dynamic POST Request using the features in Karate. I tested out the newly created request manually and It did return a 200. However, when running the request through Karate, I am getting a 415 Unsupported media type.
POST REQUEST:
{
"content": [
{
"assetId": "273108817",
"country" : "US",
"sourceSystemCode" : "GE_Clarify",
"serviceRequestCode" : "Karate-Insert: 157264280",
"serviceRequestTypeCode" : "servicerequestcorrective",
"serviceRequestStatusCode" : "Started",
"requester" : "Karate,DSL",
"problem" : "Submitted Using Karate",
"submissionTimestamp" : null,
"sourceUpdateDate": "2017-09-13T15:53:51.597Z",
"completionDate" : null,
"dueDate" : null,
"availabilityDate" : null,
"remotely" : "0",
"assetAvailability" : "Up",
"facilityCode" : "US_294629"
}
]
}
Karate Syntax
Scenario: Submit a new Service Request POST:
def ServiceRequestPostTemplate = read('classpath:testsuite/testdata/ServiceRequestServiceTemplate.json') * replace ServiceRequestPostTemplate | token | value | | assetId | assetTblAssetId | | country | country | | sourceSystemCode | sourceSystemCode | | serviceRequestCode | 'Karate-Insert: ' + NewServiceRequestCode |
Given path 'serviceRequests/' And request ServiceRequestPostTemplate
- header Authorization = 'Bearer ' + Token When method post Then status 200
Error message in below attachment. Note, I checked the request manually through Swagger UI and everything worked fine. I also passed it in as a hard coded variable in Karate and it worked fine. However, something about using the 'table' feature seems to change the media type.