mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Use mocked response data in Webhook body data #583
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rmeshksar on GitHub (Mar 9, 2024).
Originally assigned to: @StefH on GitHub.
Hi,
Imagine a mocked API returns response from this template:
This mock API triggers a Webhook call with some delays.
Is it possible in the body data of the WebhookRequest, use the value of id of the response of the original call?
@StefH commented on GitHub (Mar 10, 2024):
I think you can use:
request.bodyAsJson.id
See
https://github.com/WireMock-Net/WireMock.Net/wiki/Response-Templating#the-request-model
@rmeshksar commented on GitHub (Mar 10, 2024):
Would that be request of the original call or response from the original call?
I am looking to use the response form the original call.
@rmeshksar commented on GitHub (Mar 11, 2024):
This worked for me:
{{JsonPath.SelectToken response.bodydata.bodyAsString 'Id'}}