Reputation: 31
I am trying to send a POST
request using an expired cookie to get the session expired response. How do I get a cookie from login, save it as a variable and use it in another http
request by posting the new cookie received from login?
Upvotes: 1
Views: 1403
Reputation: 31
I finally got it to work by using regex extractor post processor. I sent a login post request with login details Then I extracted the Session ID(sessID) from the Login response header and stored it in a variable using regex extractor. in the other requests, I replaced the session id value with the variable ${sessID} created with regex extractor and it worked.
Upvotes: 1
Reputation: 168217
Normally JMeter's HTTP Header Manager should automatically handle cookies, if it doesn't - there is a problem with the cookie itself and you should raise an issue against your application.
If you are absolutely sure that the cookie is OK and JMeter should be properly processing it you can try the following workarounds:
Choose a less restrictive "Cookie policy", i.e. Netscape
from the relevant dropdown
Add the next line to user.properties file (lives in "bin" folder of your JMeter installation)
CookieManager.check.cookies=false
More information: HTTP Cookie Manager Advanced Usage - A Guide
If above hints don't help - enable debug logging for the HTTP Cookie Manager and update your question with the relevant entries from the log file
Upvotes: 0