Forum Discussion

davissoap's avatar
davissoap
Occasional Contributor
8 years ago

Unable to find cookie after redirect

I am testing a rest service which generates a cookie .It is generated as below

Rest service redirects to server 1

Generate a cookie From server 1 and do a redirect to server 2

 

Now I need to write SAOP UI test case which basically would check the above generated cookie.

 

I am using the following in my  assertion 

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

 

it always print Not Found Cookie in the response headers in the log as it doesn't find the coookie.I can see the cookie and its value in http log.is there any configuration i need to do .

 

Any help would be very welcome.

4 Replies

    • davissoap's avatar
      davissoap
      Occasional Contributor

      I am sorry it didn't help me.If i set followredirect to false then the second redirect doesn't happen.But in my case the two redirects should happen .

      As fot the out put is concerned , the assertion code is unable to find the cookie as there is no cookie.

       

      We used postman and encountered the same issue , where the cookie was simply not there.But when we used an interceptor, we were able to see the cookie.

      Basically SOAUP UI doesn't keeptrack of cookie after two redirects.Cookies are there when "followredirect"is set to false but that stops the second redirect from happening