Hi Team,
In the request header, is there a possiblity in wiremock to fetch the dynamic data.
For eg.
"Authorization" : {{dynamic-data}}
Is this is the approach?
There is an api, which will consist this Authorization header, in this how dynamic data can be fetched.
b
Bas Dijkstra
04/29/2023, 6:24 PM
Hey @Shruti Mishra , I think what you’re looking for is response templating (or in other words, reusing request values in the response). Have a look at https://wiremock.org/docs/response-templating/ and more specifically at using {{request.headers.Authorization}}
s
Shruti Mishra
04/30/2023, 7:16 AM
Hi @Bas Dijkstra, in the request header wanted to validate the value...based upon that required to have a response.
For eg: In the request header
"Abc" : {{dynamic value(base 64 encoded)}}
Have to decode that value.
Apply the validation and check if that decoded value contains certain chars.
If yes render 200 response else 400 response.
Here I dont wanted to reuse the value in response, instead have to apply validation and toggle the success and failure response.
Thanks.
@Bas Dijkstra Can you please provide me some example related to this.