HTTP requests and HeaderManager

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

HTTP requests and HeaderManager

Antony Bowesman
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.