You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Antony Bowesman <An...@williamhill.com.au> on 2016/12/23 03:44:56 UTC

HTTP requests and HeaderManager

Could be way off target here, as I'm a bit of a newbie.

I have a custom java sampler that uses a HeaderManager to manage headers in multiple requests. My sampler makes a number of http requests in a single sample to form part of a dynamic 'transaction' and this means that different requests may need different headers, e.g. some could be GET, some POST, some require CSRF headers etc.

I'm using an HTTPSamplerBase implementation and it appears there's no distinction between a default header and a request header that just applies to the request to be sent, could be wrong, but I can't see any way to separate the two in the API.

My solution is to manage default and request headers is a wrapper class that will remove headers after the request is made, so they do not pollute subsequent requests.

However, from my basic reading of the code, the header manager is using an ArrayList to store headers and to remove a header, it has to iterate that list.

Is there any reason why it would not be more sensible to use a LinkedHashSet. Slightly additional overhead in storage, but much faster in removing elements.

Cheers