https://linen.dev logo
#help
Title
a

Aidan Egan

08/29/2023, 10:11 PM
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

Lee Turner

08/30/2023, 7:52 AM
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

Aidan Egan

08/30/2023, 3:36 PM
ah I forgot the
"transformers": ["response-template"]
part in the response. Works now, thank you!
👍 1