You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Guruprasad R <gu...@gmail.com> on 2015/08/24 10:32:19 UTC

Posting Cookies for particular request types

Hi,

I have a thread group containing a single HTTP sampler. I am using a CSV
file containing a list of input parameters.

Problem:
Whenever i read "0" from the CSV, i need to extract the sessionID [from
response body] & Cookie [from response header].
Whenever i read anything other than "0" from the CSV, i need to pass the
Cookie parameter in the request. Is it possible to achieve this by using a
single HTTP sampler?

Regards,
Guruprasad R

Re: Posting Cookies for particular request types

Posted by Guruprasad R <gu...@gmail.com>.
hi Deepak,

As you suggested, i am going by the conventional method of using the cookie
manager.

Regards,
Guruprasad R

On Mon, Aug 24, 2015 at 8:10 PM, Deepak Shetty <sh...@gmail.com> wrote:

> Hi
> yes - The question is why ?
> The "yes" refers to the fact that you can interact with the JMeter APIs to
> set headers or programmatically work with the CookieManager(
>
> http://jmeter.apache.org/api/org/apache/jmeter/protocol/http/control/CookieManager.html
> )
> to get any behavior you desire with Java code
> However you really dont want to be specifying when and when not to read a
> cookie from your CSV file - Why dont you allow it to happen automatically ?
> If the Server sets a cookie and JMeter has a cookie manager , then it will
> save and send it on the next request (based on normal cookie rules). If you
> are trying to use multiple session cookies on the same thread, then as long
> as the cookies are not interleaved you should be ok (Cookie Manager has the
> clear cookies every iteration setting)
>
> On Mon, Aug 24, 2015 at 1:32 AM, Guruprasad R <gu...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I have a thread group containing a single HTTP sampler. I am using a CSV
> > file containing a list of input parameters.
> >
> > Problem:
> > Whenever i read "0" from the CSV, i need to extract the sessionID [from
> > response body] & Cookie [from response header].
> > Whenever i read anything other than "0" from the CSV, i need to pass the
> > Cookie parameter in the request. Is it possible to achieve this by using
> a
> > single HTTP sampler?
> >
> > Regards,
> > Guruprasad R
> >
>



-- 
Guruprasad R
Do it or Do not, there is no try!!

Re: Posting Cookies for particular request types

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
yes - The question is why ?
The "yes" refers to the fact that you can interact with the JMeter APIs to
set headers or programmatically work with the CookieManager(
http://jmeter.apache.org/api/org/apache/jmeter/protocol/http/control/CookieManager.html)
to get any behavior you desire with Java code
However you really dont want to be specifying when and when not to read a
cookie from your CSV file - Why dont you allow it to happen automatically ?
If the Server sets a cookie and JMeter has a cookie manager , then it will
save and send it on the next request (based on normal cookie rules). If you
are trying to use multiple session cookies on the same thread, then as long
as the cookies are not interleaved you should be ok (Cookie Manager has the
clear cookies every iteration setting)

On Mon, Aug 24, 2015 at 1:32 AM, Guruprasad R <gu...@gmail.com>
wrote:

> Hi,
>
> I have a thread group containing a single HTTP sampler. I am using a CSV
> file containing a list of input parameters.
>
> Problem:
> Whenever i read "0" from the CSV, i need to extract the sessionID [from
> response body] & Cookie [from response header].
> Whenever i read anything other than "0" from the CSV, i need to pass the
> Cookie parameter in the request. Is it possible to achieve this by using a
> single HTTP sampler?
>
> Regards,
> Guruprasad R
>