Hi all, I needed help I wanted to use the stubbed ...
# help
j
Hi all, I needed help I wanted to use the stubbed response in the request body for webhook using response templating. Is there any way to do it? For eg. I generate a random UUID in the stubbed response for the original request and want to use that same UUID in the webhook request body.
o
Hi. Response transformer from https://github.com/9cookies/wiremock-extensions, maybe?
I actually used it on the weekend for a similar usecase in my WireMock Testcontainers Module documentation https://github.com/wiremock/wiremock-testcontainers-java
See "Using WireMock extensions" section for the latter
j
Thanks! Going through the docs.
I think I can use the response simulator to get the response param and use it in the webhook request body
o
Yes, it could be an option too
j
@Oleg Nenashev Do I need to build a jar and add it to the classpath if I want to use it with Wiremock standalone server?
o
You can download the jar of the extension from GitHub packages, and then follow the Documentation
Do you run WireMock standalone in Docker? If so, I consider adding the extension manager into the image in the future so that the SDKs are more simple. No commitment/ETA for now
j
Yes I run it with Docker in standalone mock. Okay sure
o
So no you can just use mvn dependency:get when building the docker image to put them into the extensions directory. There need to specify a jar-with-dependencies similar to the example I shared. And then pass the --extensions argument to WireMock
Later I will speak to @Tom about extending the configuration file spec so that it would include maven locations for the extensions and hence the docker builder could download them
1
j
Yes for now will add the jar to the directory and specify it the classpath. So good news is it is working with the callback-simulator as per my use case locally, will check with docker how it runs
👍 1
Thank you @Oleg Nenashev
o
Happy to help! If you would be interested to write a few paragraphs on this use-case, happy to help to add it to the documentation!
j
Sure will write up a paragraph on this weekend!
👍 1
o
Thank you! Generally I want to add a section to the documentation that would store Short recipes for common use cases, and it would be a nice use case for sure