https://linen.dev logo
#announcements
Title
# announcements
s

Shruti Mishra

04/28/2023, 12:16 PM
Hi Team, Is there any feature in slack which enables us to fetch the data dynamically in header parameters. Thanks.
t

Tom

04/28/2023, 12:19 PM
Hi @Shruti Mishra, in slack or in WireMock? If WireMock, do you mean grabbing data from request headers to use in the response?
s

Shruti Mishra

04/28/2023, 12:40 PM
Hi @Tom In wiremock, in the header section section, just wanted to know about this approch whether it is doable. "Key": ${value will be coming dynamically} We want to fetch the values coming dynamically, and validate the content inside the value. Here two steps are involved 1. Fetching the values dynamically. 2. Validating the content in order to proceed further.
t

Tom

04/28/2023, 12:41 PM
Request headers or response?
s

Shruti Mishra

04/28/2023, 12:43 PM
@Tom Request headers
t

Tom

04/28/2023, 12:45 PM
OK, request headers aren’t in the templating system so if you wanted to modify those dynamically you’d need to write an extension class. Probably the type you’d need is
StubRequestFilter
. See here for an example of how to implement one of these: https://github.com/wiremock/wiremock/blob/master/src/test/java/com/github/tomakehurst/wiremock/RequestFilterAcceptanceTest.java#L204
s

Shruti Mishra

04/28/2023, 12:47 PM
@Tom Sure. Thanks, will try this one.
👍 1