I am using Karate for API automation and included mocks which works good. But i wanted to mock responseCookies also as it needs to be used in next request. I have handled with javascript function but is there any direct karate method available ?
I am using Karate for API automation and included mocks which works good. But i wanted to mock responseCookies also as it needs to be used in next request. I have handled with javascript function but is there any direct karate method available ?
No, but it should be very simple since you can form a Set-Cookie header yourself. Here is an example:
* def responseHeaders = { 'Set-Cookie': 'foo=bar' }
You may not need it, but an example of setting all the advanced options is as follows:
* def responseHeaders = { 'Set-Cookie': 'foo=bar; expires=Wed, 30-Dec-20 09:25:45 GMT; path=/; domain=.example.com; HttpOnly; SameSite=Lax; Secure' }