Hi there! I am using the dockerized version of wir...
# general
s
Hi there! I am using the dockerized version of wiremock, everything working well except the response templating
{{now}}
. I looked everywhere to find out how to activate it. Could you please help me? • How I start the container :
Copy code
docker run -itd --rm -p 9000:8080 --name wiremock -v $PWD/mocks:/home/wiremock wiremock/wiremock
• My Stub in
$PWD/mocks/stub-get-session-200.json
Copy code
{
  "request": {
    "method": "GET",
    "url": "/api/v1/session"
  },
  "response": {
    "status": 200,
    "jsonBody": {
      "expiresAt": "{{now offset='900 seconds'}}"
    },
    "transformers": [
      "response-template"
    ],
    "headers": {
      "Content-Type": "application/json"
    }
  }
}
• The response when I call the API
<http://localhost:9000/api/v1/session>
Copy code
{
  "expiresAt": "{{now offset='900 seconds'}}"
}
t
Hi @sidi amine bouhamidi you need to add the
--local-response-templating
CLI parameter when starting up WireMock.
s
thank you @Tom for your answer. I started my container with the extra parameter but still have the same problem described above.
Copy code
docker run -itd --rm -p 9000:8080 --name wiremock -v $PWD/mocks:/home/wiremock wiremock/wiremock --local-response-templating
oh! now it's working. I added
"transformers": ["response-template"]
and everything is working well now
thank you @Tom
👍 1