Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can you add a header to a specific request in JMeter?

I’ve got a test fragment that makes a few requests, which work fine. I now want to add a new PUT request that uploads a file to a an azure storage account container. I currently get a 400 with an error that a mandatory header hasn’t been included. After a little research it appears I need the ‘x-ms-blob-type’ header with a value of ‘BlockBlob’.

This is where my issue lies. I’ve added an HTTP Header Manager to that particular request, but the header doesn’t seem to get added. There is a Header Manager at the fragment level, that is used to apply generic headers to all requests, but this header manager is just for that request. I was expecting the 2 to be merged, but it looks like no headers are being applied to that particular request.

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

>Solution :

Your expectation is correct, HTTP Header Managers obey JMeter Scoping Rules and top-level headers are being recursively merged to the local HTTP Header Managers.

enter image description here

So try looking at Request -> Request Headers tab of the View Results Tree listener and see what headers are being sent

Additionally you can enable debug logging for JMeter’s HTTP components by adding the next line to log4j2.xml file

<Logger name="org.apache.http" level="debug" />

and upon JMeter restart you should see the outgoing headers in jmeter.log file

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading