'How can I decode the http encrypted cookie in Jmeter

I am now using Jmeter to prepare a test plan for my web. The rough flow of the script is that I can check my profile after login. I tried to run my recorded script, and found that the cookie is encoded in http format which I don't want it to be.

Therefore, I would like to ask is there anyway so that I can have a not encrypted cookie value?

[I applied a cookie manager in the script. The value of the cookie now is something like "%22mh8eIAH8rfsZsM3r%22". The value that I want is something like "mh8eIAH8rfsZsM3r"]



Solution 1:[1]

%22 means " which is percent-encoded, if you want to decode it back - take a look at __urldecode() function:

enter image description here

In general you should not be recording any cookies, you need to add a HTTP Cookie Manager and JMeter will automatically extract incoming cookies from Set-Cookie response header and add them to the next request as Cookie header if domain and path match the ones in the cookie, it's not expired, etc

If you need to access the cookie value as a JMeter Variable the easiest way is adding the next line to user.properties file:

CookieManager.save.cookies=true

and upon JMeter restart you will be able to use the cookie value as ${COOKIE_your-cookie-name-here}

More information: HTTP Cookie Manager Advanced Usage - A Guide

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T