I am using jmeter to runa load test. Since i have multiple HTTP Requests
with different Bearer tokens. I have used a Beanshell Preprocessor to add
this header element.
My script is as follows.
import org.apache.jmeter.protocol.http.control.Header;
sampler.getHeaderManager().add(new Header("Authorization","Bearer
b2f963c5d0ec61dad1f3844f4f25c66"))
The problem is as the test proceeds, it keeps on adding header to the
request.
Req 1
Request Headers:
Connection: keep-alive
Authorization: Bearer b2f963c5d0ec61dad1f3844f4f25c66
Host: gateway.api.cloudstaging.wso2.com
User-Agent: Apache-HttpClient/4.2.6 (java 1.5)
Re2 n
Request Headers:
Connection: keep-alive
Authorization: Bearer b2f963c5d0ec61dad1f3844f4f25c66
Authorization: Bearer b2f963c5d0ec61dad1f3844f4f25c66
Host: gateway.api.cloudstaging.wso2.com
User-Agent: Apache-HttpClient/4.2.6 (java 1.5)
Re m
Request Headers:
Connection: keep-alive
Authorization: Bearer b2f963c5d0ec61dad1f3844f4f25c66
Authorization: Bearer b2f963c5d0ec61dad1f3844f4f25c66
Authorization: Bearer b2f963c5d0ec61dad1f3844f4f25c66
Authorization: Bearer b2f963c5d0ec61dad1f3844f4f25c66
Host: gateway.api.cloudstaging.wso2.com
User-Agent: Apache-HttpClient/4.2.6 (java 1.5)
I have added HttpHeaderManager but it does not have any attributes added
and authorization header is added in Beanshell Preprocessor.
Where things going wrong in Beanshell Preprocessor?
If i add the authorization header to HttpHeaderManager things work fine.
Thanks.
Ishara Cooray
Senior Software Engineer
Mobile : +9477 262 9512
WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware