Forum Discussion

nacroaz's avatar
nacroaz
New Contributor
8 years ago
Solved

Cookie issue with SoapUi 5.1.2

Hi,

 

I'm not able to retrieve the cookies sent by the server when using a script in an assertion (same in a test case using a script step).

Here is the example I'm using in the assertion:

 

if (messageExchange.responseHeaders.containsKey('Set-Cookie')) {
log.info "Found Cookie in the response headers"
def cookiez = messageExchange.responseHeaders['Set-Cookie'].value
def list = []
cookiez.each { cookies ->
list.add(cookies.toString())
}
log.info list
} else {
log.warn "Not Found Cookie in the response headers"
}

 

I always gets the error message "Not Found Cookie in the response headers". 

In the http log I can see the cookies sent by my server.

 

For TestCases, I have set the "Authenticate Preemptively" in HTTP settings and "Maintain HTTP session" in Test case options.  But still not able to retrieve cookies.

 

Is this suppose to work ?

 

Thanks

 

  • I have set the "Follow Redirects" properties to false and it's working now.

    The server was asking for a redirect.

     

    Thanks

1 Reply

  • nacroaz's avatar
    nacroaz
    New Contributor

    I have set the "Follow Redirects" properties to false and it's working now.

    The server was asking for a redirect.

     

    Thanks