https://linen.dev logo
#general
Title
# general
j

jagroop bhanot

03/02/2023, 9:40 AM
I am trying to mimic a scenario where I have mappings defined in json file with request and response and i want to inject variable delay. Variable delay is that i will pass a header with field "delay" and value anything like "2000" or "4000" which means 2sec or 4 sec and i want to use the header value in the "fixedDelay" attribute in the json mapping.
"fixedDelayMilliseconds" : "{{request.headers.delay \"type\":'NUMERIC'}}",
The problem is :- request.headers.delay contains string value and i am not able to convert to integer in json mapping.
fixedDelay attribute takes integer only.
What is the way to have variable delay inject from the postman request header ?
t

Tom

03/02/2023, 9:42 AM
Hi @jagroop bhanot the only way you can do this at the moment is to write a response definition transformer extension and register it with WireMock at startup. Templates expansion isn’t currently enabled on all fields, just header and body values
j

jagroop bhanot

03/02/2023, 9:44 AM
Thank you @Tom for your reply.
👍 1
2 Views