How to implement a request body-dependent response? #33

Closed
opened 2025-12-29 14:21:21 +01:00 by adam · 2 comments
Owner

Originally created by @Yopt on GitHub (Jun 20, 2017).

Originally assigned to: @StefH on GitHub.

Dear @StefH,

consider request body contains complex data (xml as plain text) in a certain known format.
I have to create corresponding mock response by parsing body and transforming it using known rules.
Is it possible to implement this logic by means of WireMock?

Regards

Originally created by @Yopt on GitHub (Jun 20, 2017). Originally assigned to: @StefH on GitHub. Dear @StefH, consider request body contains complex data (xml as plain text) in a certain known format. I have to create corresponding mock response by parsing body and transforming it using known rules. Is it possible to implement this logic by means of WireMock? Regards
adam added the question label 2025-12-29 14:21:21 +01:00
adam closed this issue 2025-12-29 14:21:22 +01:00
Author
Owner

@StefH commented on GitHub (Jun 20, 2017):

You can indeed use transformation wiki - response-templating using handlebars.

For example see:
4fa295edb7/test/WireMock.Net.Tests.old/ResponseTests.cs (L42)

@StefH commented on GitHub (Jun 20, 2017): You can indeed use transformation [wiki - response-templating](https://github.com/WireMock-Net/WireMock.Net/wiki/Stubbing-and-Request-Matching#response-templating) using **handlebars**. For example see: https://github.com/WireMock-Net/WireMock.Net/blob/4fa295edb71e6d3f391190fb37c628872358b413/test/WireMock.Net.Tests.old/ResponseTests.cs#L42
Author
Owner

@Yopt commented on GitHub (Jun 22, 2017):

Fine, thank you

@Yopt commented on GitHub (Jun 22, 2017): Fine, thank you
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#33