Dynamic Headers in JMeter

Dynamic-bright-vector-background

Don’t lose your heads! A great way to set headers for every request is by using an HTTP Header Manager.

HTTP Header Manager

 

 

Within a BeanShell PreProcessor the request can then be build. In this case we are sending the hash as part of each request.

Hash in request

 

DYNAMIC HEADER

There might be a time when the hash should no longer be sent as part of the request but as signature in the header instead. Luckily this can also be achieved with the HTTP Header Manager by simply using a parameter as value which can be filled within the BeanShell PreProcessor.

Dynamic Header

 

 

In the request, we can fill this parameter easily by using vars.put

Dynamic Header

Voila, the has will now be sent as part of the Header and no longer as part of the request while still maintaining a dynamic hash which gets calculated for each request individually.