Reputation: 95
How can I Extract these three cookies from a request and pass them as headers in second request
First Request:
Second Request:
Upvotes: 6
Views: 14452
Reputation: 168207
For JMeter:
Add the next line to user.properties file:
CookieManager.save.cookies=true
Restart JMeter to pick the property up.
This way JMeter will store all cookie values as JMeter Variables.
Add HTTP Header Manager as a child of the 2nd request and configure it as follows:
See HTTP Cookie Manager Advanced Usage - A Guide article for more HTTP Cookie Manager tips and tricks.
Upvotes: 1
Reputation: 25921
Try using the pm.cookies.get() function to extract the cookie values that you require:
This can then be set in an environment
or global
variable and using it in any request you want.
This is an example using the jsonplaceholder site and logging the cookie value to the Postman console.
You could then use the pm.environment.set('my_cookie', pm.cookies.get('cookie_value'))
function and store it as an environment variable. This can then be used in the next/any request's Header
by referencing it with the {{my_cookie}}
syntax.
Upvotes: 8