Closed vovka15 closed 4 months ago
@vovka15 A possible way would be to use the existing Handlebars functions, see the documentation from Handlebars.Net for details. In case, there is no function available, maybe a function is present in https://github.com/Handlebars-Net/Handlebars.Net.Helpers (for example Dynamic
If that is also not enough, you can write the function in c# with: WithBody
and a callback function --> https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/ResponseBuilders/IBodyResponseBuilder.cs#L29
Thanks for suggestions! I will report later after tests
I used second variant and it works like a charm. Thanks a lot!
Hello!
Question:
Is there a way to access templated data after transformation?
Context:
I am trying to perform some operations on response body AFTER transformation happened and THEN respond with modified body.
Example:
Request:
I have possibility to access it's body by using templates. So code would look like this:
But the problem is I want to modify some fields of that request and add new field that depends on values that arrive in the given request - for example, operation that concatenates all received fields and returns base64 value of it.
So I want to pass received request in some function, manipulate it's data and only then return response.
I've tried that stupid solution, but it of course doesn't work.
Maybe there is solution, but I did not find any in the current wiki.
Can you please tell is there possibility to do that?