Hi all! So I'm running standalone WireMock and I'...
# help
r
Hi all! So I'm running standalone WireMock and I've ran into a use case. I wonder if you guys can give me any insight. I'll leave it in the thread.
The service my application consumes has a certain amount of updates in their responses periodically. I have set up my
urlPathPattern
of multiple requests, but I want to update my responses without having to do too manual steps (such as doing the request and paste the response over the .json file. I've tried removing the response file itself and even removing the
bodyFileName
from the mapping file but it didn't work. My question is: is it possible to set/remove any attribute from the mapping json to force it overwrite the current stubbed response or do I really have to do it manually? The goal of this is to improve time (since there are multiple requests) and possibly reduce human error. Hope I was clear with my question 🙏 Thank you all!
l
When you say
I've tried removing the response file itself and even removing the bodyFileName from the mapping file but it didn't work.
I am not sure what you mean. I guess you could automate this somehow with the WireMock admin API. Get the response from the real server and up update the mapping file via the API ?
r
What I mean by that is when running WireMock standalone it creates mappings and __files directories. Inside the mappings there is the json mapping which has an attribute that seems to reference the file that stubs the respective response. If I removed this outlined reference or the file it refereces, I would expect WireMock to call the real service.
l
Ah, that isn't how it works. If you want to call the real service then you need to setup wiremock in a proxy/intercept pattern - https://wiremock.org/docs/proxying/#proxyintercept When doing this, if wiremock matches a stub then it will return the stubbed response, otherwise it will proxy through to the real service