# How to get cookie value from the request header?

**URL:** <https://forum.katalon.com/t/how-to-get-cookie-value-from-the-request-header/61332>\
**Category:** API Testing\
**Tags:** api-testing, katalon-studio\
**Created:** [January 4, 2022, 10:28am UTC](https://forum.katalon.com/t/how-to-get-cookie-value-from-the-request-header/61332 "2022-01-04T10:28:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sudheer.dj](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/sudheer.dj/32/16103_2.png) [@sudheer.dj](https://forum.katalon.com/u/sudheer.dj)\
**Post date:** [January 4, 2022, 10:28am UTC](https://forum.katalon.com/t/how-to-get-cookie-value-from-the-request-header/61332/1 "2022-01-04T10:28:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 5, 2022, 8:15am UTC](https://forum.katalon.com/t/how-to-get-cookie-value-from-the-request-header/61332/2 "2022-01-05T08:15:52Z")

</div>

> [@sudheer.dj](#):
>
> How to get cookie value from the request header?

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

> [@sudheer.dj](#):
>
> as it is returning null

What is “it”? What is returning null?

* * *

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

 ![code formatting](https://europe1.discourse-cdn.com/katalon/original/3X/3/f/3f0611012346e0c9ee9918c00cfc288c38b29653.png)

---

<div class="post-metadata">

**Author:** ![sudheer.dj](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/sudheer.dj/32/16103_2.png) [@sudheer.dj](https://forum.katalon.com/u/sudheer.dj)\
**Post date:** [January 17, 2022, 11:14am UTC](https://forum.katalon.com/t/how-to-get-cookie-value-from-the-request-header/61332/3 "2022-01-17T11:14:29Z")

</div>

Thanks @kazurayam  
Issue is resolved.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 17, 2022, 12:47pm UTC](https://forum.katalon.com/t/how-to-get-cookie-value-from-the-request-header/61332/4 "2022-01-17T12:47:07Z")

</div>

Closed on January 17, 2022, 12:47pm UTC


