Reputation: 127
I am unable to calculate the response header size in Jmeter.
I want to calculate the response header size and i tried below option but i was unsuccessful. Option 1: Parse the value returned in Sampler result --> i do not have an inbuilt option. Option 2: Store the response header in a variable and calculate the length using var.length() function. --> since the response header have new line feeds, the .length function did not work.
Can anyone please suggest me to calculate the response header size in bytes.
Thanks in advance,
Regards, Hari
Upvotes: 1
Views: 919
Reputation: 127
We can also do in BeanShell and below is the snippet of the Code
Add a Bean Shell Post Processor
write
response_Header = prev.getResponseHeaders();
response_Header_Size = new Integer(response_Header.length());
vars.put("response_Header_Size", response_Header_Size.toString());
Works for Jmeter 2.13
Upvotes: 1
Reputation: 167992
It should be something like:
prev.getResponseHeaders().size();
Where prev
is a shorthand to SampleResult class instance.
Be aware that starting from JMeter 3.1 users are encouraged to switch to JSR223 Test Elements and Groovy language for any form of scripting as Groovy:
See Apache Groovy - Why and How You Should Use It article for more details
Upvotes: 0