https://linen.dev logo
Title
j

Joydeep Das

04/21/2023, 6:43 AM
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

Oleg Nenashev

04/21/2023, 6:54 AM
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

Joydeep Das

04/21/2023, 6:57 AM
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

Oleg Nenashev

04/21/2023, 7:00 AM
Yes, it could be an option too
j

Joydeep Das

04/21/2023, 7:04 AM
@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

Oleg Nenashev

04/21/2023, 7:07 AM
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

Joydeep Das

04/21/2023, 7:32 AM
Yes I run it with Docker in standalone mock. Okay sure
o

Oleg Nenashev

04/21/2023, 8:40 AM
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

Joydeep Das

04/21/2023, 9:14 AM
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

Oleg Nenashev

04/21/2023, 9:23 AM
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

Joydeep Das

04/21/2023, 9:24 AM
Sure will write up a paragraph on this weekend!
👍 1
o

Oleg Nenashev

04/21/2023, 9:25 AM
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