So, I'm writing a mock definition in JSON (for a s...
# help
b
So, I'm writing a mock definition in JSON (for a standalone WireMock instance), and I'm looking to use response templating to echo the value of an element
quantity
from the request body in a response. Using
"quantity": "{{jsonPath request.body '$.quantity'}}"
it works, but that converts the element in the response to a string, not an integer. If I remove the double quotes, WireMock tells me my JSON is invalid. How can I easily return request body integer values as an integer in the response?
l
Are you using
jsonBody
to return your response body? If so you might have to change that to
body
b
That works, thanks @Lee Turner. Ugly, but it does the trick for now.
🙌 1
l
Yeah, there isn't a nice way to do this with non string items as far as I know
b
No worries, it's good to know. This one's 'only' for the purpose of having something to have a crack at in an API security testing workshop anyway