How to set a cookie as a variable to the api request


#1

Hi,

I´m trying to test the API by sending GET and PUT requests.
I´m not opening any browsers in this test case.

The GET Request works properly and I receive the parameters “set-cookie” and “x-csrf-token” in the response header. Now, if I use the parameter values in my PUT request, for authentication, it doesn’t work.

After adding the cookie to the HTTP header of the PUT request I getting 400 BAD REQUEST.
If I don´t add the cookie to the HTTP header of the PUT request I getting 403 FORBIDDEN.

The same requests (body and header) works fine in rest clients like postman.

Http Header GET:

Http Header PUT:

header_put.png

header_get.png


#2

@jonathanT , If you use katalon v 5.8.0. then change Object Repository file to “text” may be it work.

for more info click on : https://forum.katalon.com/discussion/10165/post-api-is-not-working-on-version-5-8-0#latest


#3

Hello jonathan

You can be check in the link : Pass cookie in API