How to get cookie value from the request header?

How to get cookie value from the request header?

I have written this piece of code, as it is returning null because the cookie is under request headers.

def response = WS.sendRequestAndVerify(findTestObject(‘PriceAndAvailability/getGivenPartNumbersPrice’, [(‘baseUrl’) : GlobalVariable.url]))

def headerFields = response.getHeaderFields()
println headerFields
println headerFields[‘Set-Cookie’]

Someone please help

@kazurayam @Andrej_Podhajsky

It seems you are looking at the “response” header. Do you still want to see “request” header? Or just a typo?

What is “it”? What is returning null?


Please use “code formatting” syntax in the post for better readability.

Thanks @kazurayam
Issue is resolved.