Postman通过脚本设置请求的cookie
- 前端
- Stella981
- 0
关于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
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/
免责申明:本站发布的内容(图片、视频和文字)以转载和分享为主,文章观点不代表本站立场,如涉及侵权请联系站长邮箱:xbc-online@qq.com进行反馈,一经查实,将立刻删除涉嫌侵权内容。