wiremock-webhooks-extension icon indicating copy to clipboard operation
wiremock-webhooks-extension copied to clipboard

How to change new request body in standalone mode via json configuration

Open wbulba opened this issue 5 years ago • 2 comments

this is my template

{ "request": { "method": "POST", "url": "/api/mytestingwebhooksextension" }, "response": { "status": 200, "body": "{"id":"{{jsonPath request.body '$.Object.id'}}, "udid":"{{randomValue type='UUID'}}"}"" }, "postServeActions" : { "webhook" : { "headers" : { "Content-Type" : "application/json" }, "method" : "POST", "body" : "{"id":"{{jsonPath request.body '$.Object.id'}}, "udid":"{{randomValue type='UUID'}}"}"", "url" : "http://127.0.0.1:8081/api/mytest" } } }

i am run standalone wiremock with option --global-response-templating

this section is transform well for response, but not transform for request body": "{"id":"{{jsonPath request.body '$.Object.id'}}, "udid":"{{randomValue type='UUID'}}"}""

in response i see {"id":"17, "udid":"7d138e9b-efb5-4704-8248-98e34fdbc51d"}"

but in sending request i see "{"id":"{{jsonPath request.body '$.Object.id'}}, "udid":"{{randomValue type='UUID'}}"}"

wbulba avatar Jan 14 '20 12:01 wbulba

I'm also interested to know.

VorobeyEugene avatar Apr 10 '21 13:04 VorobeyEugene

I've been working on a new version of the webhooks extension. It's nearly ready to be released and supports delays, templating, multiple webhooks and runs standalone.

The docs are here if you'd like a quick look: https://github.com/tomakehurst/wiremock/blob/webhooks-core-extension/docs-v2/_docs/webhooks-and-callbacks.md

tomakehurst avatar Jul 20 '21 16:07 tomakehurst