问题
I need to get the value of a cookie, that is only created when I send a request in postman.
I have tried everything but I don't know how to achieve this. I also need to store that value to use in further requests for my project.
cookie name: JSESSIONID
value:09840****************00C44
回答1:
You could use the pm.environment.set('my_cookie', pm.cookies.get('JSESSIONID')) function in the Tests tab and store it as an environment variable.
This can then be used in the next/any Request Body or Request Header etc by referencing it using the {{my_cookie}} syntax.
A very similar issue can be found here.
来源:https://stackoverflow.com/questions/49259402/get-and-store-the-value-of-a-cookie-using-postman