Hello WireMock team, Let me recommend you a quest...
# help
g
Hello WireMock team, Let me recommend you a question: https://stackoverflow.com/questions/77192933/wiremock-newscenariostate-based-on-request-model -------------------------------- Is it possible to use request model attributes in
newScenarioState
field? Example:
Copy code
{
    "scenario" : "my-scenario",
    "newScenarioState" : "{{request.pathSegment.[1]}}",     //or {{request.someId}} ?

    "request" : {
       "urlPatternTemplate" : "/path/{someId}"
    }
}
Unfortunately
{{request.pathSegment.[1]}}
will be empty for newScenarioState, but it has proper value under
request
json node, looks like variable scope issue. Thanks in Advance Gergely
t
It’s not possible to use templating in scenario fields at the moment. This would make a great PR though.
g
thanks Tom might be any alternative solution? or workaround?
t
You could create a
ResponseTemplateTransformer
implementation that dynamically changed the scenario values per your requirements