Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jmeter header manager remove header

I have a large and deep test and am using jmeter 2.1.3.

I have a default http header manager at the top level and inherited for all the samplers below.

Deep in the test structure i need to make an http request and remove all the headers inherited from the parent manager.

The docs say this is achieved by creating a child manager for this sample and declaring the header with a null value, however this just sends a null value over the air and doesnt strip the header completely from the request.

Any ideas? I really dont want to create a child manager for every sample just to over come this issue as im often tweaking the values to 99% of the samples

like image 918
Mike Garrie Roberts Avatar asked Jan 11 '16 14:01

Mike Garrie Roberts


2 Answers

Found a cool way to sort it, as i just couldn't get the header manager to do what i think its meant to from the docs. I added a BeanShell PreProcessor to the sampler i didn't want an inherited header to be used at all with the following:

sampler.getHeaderManager().removeHeaderNamed("Authorization");

Adding this as a child will only make the script affect the current sampler and would not impact the default if it was set.

like image 86
Mike Garrie Roberts Avatar answered Nov 11 '22 00:11

Mike Garrie Roberts


In your header manager at the top level, you could set the values as a variable, then later change that variable in a beanshell script.

like image 24
jgabb Avatar answered Nov 10 '22 23:11

jgabb