Good Morning everybody. I am trying to do somethin...
# general
v
Good Morning everybody. I am trying to do something similar to https://wiremock.org/docs/response-templating/#json-2 (using request.pathSegments in bodyFileName), but I endup with
NotFoundException: Not found in blob store: files/{{request.pathSegments.[2]}}
It is not intepreting my variable between {{ }} but considering it as a String. To me it looks like I am doing exactly what the documentation states. Am I missing something ? Here is my complete JSON :
{
"request": {
"method": "GET",
"urlPathPattern": "/blabla/adc/golden/.*"
},
"response": {
"status": 200,
"bodyFileName": "files/{{request.pathSegments.[3]}}",
"headers": {
"Content-Type": "image/png"
}
}
}
βœ… 1
o
Hi. Did you enable global templating?
v
Hi. Probably not, I didn't know that was a thing. I discovered WireMock yesterday. I'll search thoses keywords thx !
Not sure how I do that in JSON... My context : WireMock standalone docker, with JSON's in the mapping directory
Okay you answered helped me a lot ! I would think the documentation is missing this line ""transformers": ["response-template"]," For the JSON code snippet though.
Thank you πŸ™‚
o
Or `--global-response-templating`: Render all response definitions using Handlebars templates.
the CLI option ^
v
when launching my docker ?
o
yes
v
thx πŸ˜‰
o
We do not document enabling templates in all the examples, but probably we should add a
requirements
warning sign to those samples that need templating to be enabled. Later we would use the same engine for extension requirements, e.g. gRPC or Faker. FYI @Tom I could add it to the MkDocs Engine PR
πŸ‘ 1
t
Templating (local) is enabled by default from 3.2.0 onwards
If there are doc snippets where we’re not including the transformer element in the JSON, we should definitely add that
πŸ‘ 1
o
Hmm, I thought that all transformers will be enabled by default with the global flag