Forum Discussion

richie's avatar
richie
Community Hero
7 years ago
Solved

I need to grab some cookies for later use....

Hi,

 

This new thing I'm testing has some new OAuth security and the first thing I need to do is grab some cookies from the request.

 

I've never done this before - I know - weird - right?

 

Anyway - I have a blank payload but plenty of headers

There are 4 headers entitled Set-Cookie and each of these 4 'Set-Cookie' headers have different values - please see screenshot below

 

Spoiler

Typically if I need to capture header values for later use - I have a bit of groovy to do this (as follows:)

//Takes one of the elements of the response Header
def value = testRunner.testCase.testSteps["REST Request)"].testRequest.response.responseHeaders["headername"]

//Read this value into a parameter - writes the header value into the Properties test step
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
groovyUtils.setPropertyValue("Properties", "headername",value[0])

HOWEVER - the above is never going to work - I need to capture each of the 4 'Set-Cookie' values and they each have the same name?!??!

 

Can anyone please advise how I can grab these cookies?

 

Many thanks!

 

richie

 

 

 

 

zx