Forum Discussion

anbeek's avatar
anbeek
Occasional Contributor
13 years ago

How do I set multiple cookies in http request?

Hi

Have to get a token for testing my web site.
The token is received after a succesfull login.
So I do
1) goto startpage - here a sessionid is returned, in Set-Cookie
2) perform login (http post) - here a private id is returned in Set-Cookie
both above I got working in soapui, also got the values in from both Set-Cookie.

3) Visit a support page that based on 2 cookies in my httprequest head returns a token for later tests
This I cant figure out, how do I get 2 "Cookie" fields into the request header?

Anyone that knows?

Regards
/Anders

2 Replies

  • anbeek's avatar
    anbeek
    Occasional Contributor
    As far as got it now, a httpRequest header can only contain one 'Cookie'
    That should mean that I have to concatenate my 2 cookies.
    But not sure how to do that since it seems like a cookie contains more than a key-value pair.

    Looking at my cookies they are returned as:
    Header Value
    Set-Cookie THESESSIONID=61DR5GG123; Path=/;Secure
    Set-Cookie xid=c345bng84664856f; Domain=myhome.com; Expires=Fri, 29-Mar-2013 12:18:09 GMT; Path=/

    If it was just the key-value of the cookies that were merge togther, the Cookie header would be easy to do.
    Or is it just the key-values that should be sent to server in next request? (THESESSIONID=61DR5GG123 + xid=c345bng84664856f)

    Any cookie expert who knows?

    Regards
    /Anders
  • anbeek's avatar
    anbeek
    Occasional Contributor
    Done some more reading up on Cookies + logging my requests via Chrome plugin.

    Somehow soapui cant manage to catch all cookies, dont know why.
    I suspect that some cookies is sent in redirects. I have follow redirect = true in my testcase though.

    When running my test in jmeter (2.3.2) with the httpcookiemanager everithing works, with follow redirects = true.
    If redirects is off in jmeter the test fails there also.

    So since I need to get my tests in place we will go with jmeter. No more soapui pro licenses.

    Pitty, soapui seems to be a nice testing tool otherwise, but with no cookie support it's pretty useless in http-testing.

    Regards
    /Anders