Postman通过脚本设置请求的cookie

关于postman前置脚本的详细介绍: https://learning.getpostman.com/docs/postman/scripts/pre_request_scripts/

环境变量是key 、value 键值对,在api path上可以通过key引用变量,形式是{{key}}

pre-request script 前置脚本,每次发送http请求前,都会调用该脚本。

http的cookie是存储在headers中的,可以通过脚本引用变量的。

1、使用变量设置cookie内容

https://stackoverflow.com/questions/43471751/postman-setting-a-cookie-from-a-global-variable-with-tests-code

2、使用脚本自动注入cookie

扫描二维码关注公众号,回复: 7183264 查看本文章

https://github.com/postmanlabs/postman-app-support/issues/4631

3、自动同步Chrome浏览器的cookie

https://learning.getpostman.com/docs/postman/sending_api_requests/interceptor_extension/

https://learning.getpostman.com/docs/postman/scripts/postman_sandbox/

猜你喜欢

转载自www.cnblogs.com/afraidToForget/p/11466418.html