You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by David Luu <ma...@gmail.com> on 2012/10/10 01:17:50 UTC

Making HTTP requests with sending headers at a per request/sampler level

I want to send some HTTP headers but only with certain requests. It looks
like JMeter by default HTTP samplers don't let you set headers, but can use
HTTP header manager but that could make it into at a global level unless
you nest it properly.

Would nesting HTTP header manager as child under a HTTP sampler associate
it to that sampler only or will that not work. My HTTP samplers are
siblings to each other.

Another option to consider I guess is to use JMeter plugin's HTTP raw
request sampler to set headers as you like. I gave that a try but seems not
working right for me. I want to set "pragma: no-cache" header. Using raw
body of

GET /param1/${site}/param2/${pid} HTTP/1.1
Pragma: no-cache
Host: ${host}
Connection: keep-alive

and it seems like the connection hangs. Host field also defined as ${host}
w/ value set as user defined variable under Test Plan. Try with
"Connection: close" and it works but doesn't download the complete data,
disconnects too soon. Am I missing some additional headers to set? The
default sample data with the request doesn't give much so it looks like my
request should be ok.

Regards,
David

Re: Making HTTP requests with sending headers at a per request/sampler level

Posted by David Luu <ma...@gmail.com>.
Thanks for response, good to know of the HTTP Raw Request limitation.

Just figured out workaround for what I wanted to do with regular HTTP
sampler. Thought I'd share for novice JMeter users. Use Simple Controller
as a grouper/segregator, and nest the HTTP Header Manager and any HTTP
samplers that use the headers under that Simple Controller. The rest of the
HTTP samplers are outside that controller and not affected by or set with
those headers. There may be other ways to do it as well, this approach is
good enough for me.

On Wed, Oct 10, 2012 at 12:04 AM, apc <ap...@apc.kg> wrote:

> You are correct with headers. HTTP Raw Request is known to work with
> Connection: close only
>
>
>
> -----
> --
> Andrey Pohilko
> JP@GC Maintainer
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/Making-HTTP-requests-with-sending-headers-at-a-per-request-sampler-level-tp5715007p5715008.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: Making HTTP requests with sending headers at a per request/sampler level

Posted by apc <ap...@apc.kg>.
You are correct with headers. HTTP Raw Request is known to work with
Connection: close only



-----
--
Andrey Pohilko
JP@GC Maintainer
--
View this message in context: http://jmeter.512774.n5.nabble.com/Making-HTTP-requests-with-sending-headers-at-a-per-request-sampler-level-tp5715007p5715008.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org