Hi! I use docker image holomekc/wiremock-gui and I...
# help
o
Hi! I use docker image holomekc/wiremock-gui and I'm trying to get jwt from response, and I have a problem to make it exp time dynamically for every response for example 10 minutes later than now, but there is an issue that it expected static data, is there anyone resolved that kind of issue?
l
Hi, have you tried the
now
helper?
Copy code
{{now offset='10 minutes'}}
These are documented here - https://wiremock.org/docs/response-templating/#date-and-time-helpers
o
yes, but the problem is inside jwt template for example {{jwt ....}}, it couldn't understand other helpers like random helpers or date and time helpers
l
Could you share the stubs you are using ?
o
yes sure, { "request": { "urlPathPattern": "/token", "method": "GET" }, "response": { "status": 200, "body": "{\"accessToken\": \"{{jwt algo='HS256' key='my-secret-key' claims='{\"sub\":\"1234567890\",\"iat\":1647190634,\"exp\":1647191234}'}}\"}", "headers": { "Content-Type": "application/json" }, "transformers": [ "response-template" ] } }
I tried to use now format='unix', but it throw exception
l
Ah, ok I see you are using the jwt helper that comes with the fork of wiremock you are using. I don’t have any experience of using this to be honest as it is custom to the fork you are using. Might be worth asking the maintainer of that fork for help as they might have experience of what you are trying to do - https://github.com/holomekc/wiremock
o
Thank you for your response, I will ask
110 Views