I have a situation where I need to check the amount and return the response accordingly.
If the amount is >=100, then response would be different, else for amount < 100, i need to send error response.
Please refer the sample json in request body.
{ "accountName":"ABCZYZ", "specialCode":"MYCODE", "amount":"100", "currencyType":"MYCURRENCY" }
Below is my wiremock mapping file
{ "request": { "urlPattern": "/some/url", "method": "POST", "bodyPatterns" : [ { "matchesJsonPath" : "$[?(@.amount < 100)]" } ] },
"response": { "status": 200, "body": "MY_REPONSE_IN_JSON_FORMAT" } }
I am facing issue reagrding the above matching pattern.
Could anyone please help me for the same?
Thanks M
Try changing "100" to 100
tested like below :
Request :
JsonPath:
Response: