Hi, I am using WireMock purely to assist with mock...
# help
a
Hi, I am using WireMock purely to assist with mocking iOS UI automation tests. I have a test scenario where I need the studded JSON response to return the current epoch - 1 day for a
created_time
property. I tried adding
"created_time": "{{now offset='1 days'}}"
but it didn’t work. I am guessing I am missing some steps, can anybody point me in the right direction?
l
Did you get any date/time back in the
created_time
field ? If not then you might need to enable response templating. Once you have done that you also might need to
-1 days
for the offset -
"created_time": "{{now offset='-1 days'}}"
Here is a full example for the
response
Copy code
"response": {
    "status": 200,
    "headers": {
      "Content-Type": "application/json"
    },
    "jsonBody": {"created_time": "{{now offset='-1 days'}}"},
    "transformers": ["response-template"]
  }
a
ah I forgot the
"transformers": ["response-template"]
part in the response. Works now, thank you!
👍 1