This message was deleted.
# wiremock-java
s
This message was deleted.
a
My actual use case is that I have a scenario where a GET returns 404 initially (i.e., in STARTED state), until a POST moves it to STORED state. So DELETE should return "count: 0" in STARTED state, but "count: 1" in STORED state (and then move to STARTED again. I probably need 2 stubs anyway, but I wonder if I can get around having 2 response bodies
t
You can use transformer parameters on a stub for this. Accessed via
{{parameters.myParam}}
You set them under the
transformerParameters
in the
response
element in the stub JSON
a
Ooh, interesting, let me check that out 👍
Great, I think that will work!
Is it possible to access scenario state, even though my stub is valid for multiple scenarios? For example in the above case: can I have two stub outsides of the scenarios that handle DELETE? Or does a stub need to have
scenarioName
when it uses
requiredScenarioState
? 🤔
a
Yes - Scenarios require a name and a required state.
a
Ah okay, I guess it's easier to understand like that anyway 🙂