Ask a Question

readyAPI feature - automatic passing cookies to following request with “Maintain HTTP Session”

Occasional Contributor

readyAPI feature - automatic passing cookies to following request with “Maintain HTTP Session”

I'm on ReadyAPI 3.9.0 (trial).
Have seen documentation and tried to use “Maintain HTTP Session” other questions on the

I use Add a Header with a key name Cookie to a Request and set the Value to 


${REST login#HarResponse#$['headers'][5]['value']}


to get auth cookies in the request headers. 
    But the order of the Headers in the HarResponse json is not constant and [5] in my case is a variable list element index that is not comfortable during automated tests.
    Groovy scripting is ok but again to repeat a script for each step is inconvenient and boring in comparison with Postman or a web browser style of normal (automatic) Set-Cookie.
    More over the manual adding a Cookie section to the request headers doesn’t allow the testers (for which readyAPI has been developed) to test a “Set cookies” workflow that is not good for the specialized software that is readyAPI.
It looks like many things for start working with or migrating to readyAPI were not in a focus in the documentation...

Could you show me the easiest way to automate Set-Cookie as a result of a server response or tell me where I’m wrong with “Maintain HTTP Session” option? Hope the issue is not the case of a trial version.

Champion Level 3

Occasional Contributor

Update. To those who are switching from Postman. 
A readyAPI feature.
Automation with “Maintain HTTP Session” works fine ONLY when one runs test steps as a Test Case and doesn't work when running test steps one-by-one (for example if you try debugging a test step like in Postman). For the debug purpose in “Maintain HTTP Session” mode there are a "bug" button (next to a run button under the TestCase name) and a "Step-by-Step Run" tab.
There is lack of warnings for the feature in the docs. A lot of time has been wasted to get it worked.Screenshot 2021-08-02 at 16.06.01.png

Occasional Contributor

Thanks for the link @nmrao. I've already googled this solution and that is exactly I have mentioned in my root post (about Groovy script).

@nmrao wrote:
Please see if the below link helps

But the question is simple how to debug or write a Test Case with “Maintain HTTP Session” having a bunch of test steps in a serie??? May be the answer is too simple... 

Community Hero

Hey @sboris

I dont know if ive misunderstood, but from what youve said, it sounds like the "maintain http session" checkbox isnt working properly.

The script @nmrao mentioned or one very similar, he actually put together for me a while back when i had to do this. Immediately after he'd coded it i discovered the maintain http session option. It did and should identify the set-cookie header from a request's response and then add >= cookie (relative to how many ; separated values were sent on the set-cookie) to all other requests hitting the same domain.

Is this not happening with you?


if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Showing results for 
Search instead for 
Did you mean: