kristoffer
12 years agoNew Contributor
preserving cookies
I'm trying to read cookies.
Most pages i find when searching seems to link to http://siking.wordpress.com/2013/07/25/ ... anagement/ so thats what im trying to use.
I have created a test case with the following steps:
1) REST request to post data to /A_Page
2) Groovy script
The groovy script contains:
The problem is that the collection returned from getCookies() contains 0 items.
If i check the HTTP log window i can see that the response includes Set-Cookie headers; so items should be returned.
I can also see the Set-Cookie headers in the headers-tab if i execute the rest-step by itself.
Do i need to activate some sort of cookie setting somewhere for the getCookies() to return the cookies; which are obviously sent?
/Kristoffer
Most pages i find when searching seems to link to http://siking.wordpress.com/2013/07/25/ ... anagement/ so thats what im trying to use.
I have created a test case with the following steps:
1) REST request to post data to /A_Page
2) Groovy script
The groovy script contains:
import com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport
import org.apache.http.impl.cookie.BasicClientCookie
// Get cookie store and cookies
def myCookieStore = HttpClientSupport.getHttpClient().getCookieStore();
def myCookies = myCookieStore.getCookies();
log.info("parse cookies " + myCookies.size());
myCookies.each {
log.info(it.name);
}
assert sessionCookie;
The problem is that the collection returned from getCookies() contains 0 items.
If i check the HTTP log window i can see that the response includes Set-Cookie headers; so items should be returned.
I can also see the Set-Cookie headers in the headers-tab if i execute the rest-step by itself.
Do i need to activate some sort of cookie setting somewhere for the getCookies() to return the cookies; which are obviously sent?
/Kristoffer