从请求中提取 cookie 值 (POSTMAN/JMETER) [英] Extract cookie value from request (POSTMAN/JMETER)

查看:54
本文介绍了从请求中提取 cookie 值 (POSTMAN/JMETER)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从请求中提取这三个 cookie 并在第二个请求中将它们作为标头传递

第一个请求:

第二个请求:

解决方案

尝试使用

然后可以在 environmentglobal 变量中设置它,并在您想要的任何请求中使用它.

这是一个使用

然后您可以使用 pm.environment.set('my_cookie', pm.cookies.get('cookie_value')) 函数并将其存储为环境变量.然后可以在下一个/任何请求的 Header 中使用它,方法是使用 {{my_cookie}} 语法引用它.

How can I Extract these three cookies from a request and pass them as headers in second request

First Request:

Second Request:

解决方案

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.

这篇关于从请求中提取 cookie 值 (POSTMAN/JMETER)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆