I want to pass a null value in wiremock standalone from request to a jsonBody response, the problem that i faced is that the handle bars convert anything to string so my response is showing empty string ("") instead of null object (null).
Wiremock mapping file:
{
"request": {
"method": "POST",
"urlPattern": "/(wapi|api/msp)/test/scenario",
"cookies": {
"x-mock-scenario": {
"equalTo": "test-scenario"
}
},
"bodyPatterns": [{
"matchesJsonPath": {
"expression": "$.operationName",
"equalTo": "test"
}
}]
},
"response": {
"transformers": ["response-template"],
"transformerParameters": {
"MyCustomParameter": null
},
"headers": {
"Content-Type": "application/json"
},
"jsonBody": { "test": "{{jsonPath request.body '$.reversalDate'}}" }
}
}
Request payload:
{
"reversalDate": null
}
Expected result:
{
"test": null
}
Actual result:
{
"test": ""
}