Reuse the HTTP Header Manager in every call

1.1k views Asked by At

How to reuse the HTTP Header Manager in every call?

I have structed like this but i want to reuse to i don't have to change the values in all if i need to. I tried to use module controller method but it seems like i cant create a module controller inside a HTTP request

enter image description here

2

There are 2 answers

0
Dmitri T On BEST ANSWER

HTTP Header Manager obeys JMeter Scoping Rules so:

  1. If you place HTTP Header Manager at the same level as HTTP Request samplers - it will be applied to all of them
  2. If you put HTTP Header Manager as a child of a single HTTP Request sampler - it will be applied to this sampler only

Also according to the HTTP Header Manager documentation:

JMeter now supports multiple Header Managers. The header entries are merged to form the list for the sampler. If an entry to be merged matches an existing header name, it replaces the previous entry. This allows one to set up a default set of headers, and apply adjustments to particular samplers. Note that an empty value for a header does not remove an existing header, it justs replace its value.

Given proper placement of the HTTP Header Manager the headers defined there will be applied to the HTTP Request samplers residing under Test Fragments as well:

enter image description here

0
Ori Marko On

HTTP Header Manager is a configuration element which affects all requests in his tree, so you can put it in Thread Group level to affect all requests

A configuration element is accessible from only inside the tree branch where you place the element. For example, if you place an HTTP Cookie Manager inside a Simple Logic Controller, the Cookie Manager will only be accessible to HTTP Request Controllers you place inside the Simple Logic Controller