使用邮递员发送 cookie [英] Sending cookies with postman

查看:30
本文介绍了使用邮递员发送 cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用邮递员阅读了使用cookie发送请求的手册:

I read the manual of sending request with cookie with postman:

由于打包的应用程序在独立于浏览器的沙盒中运行,它无法访问浏览器内设置的 cookie.这个限制可以也可以使用拦截器扩展来克服.邮递员路由所有通过拦截器请求,然后使用浏览器上下文发送请求.浏览器内设置的 Cookie 是自动设置的附加到您的请求.阅读 Interceptor 上的原始博客文章.

As the packaged app runs in a sandbox separately from the browser, it can not access cookies set inside the browser. This restriction can also be overcome using the Interceptor extension. Postman routes all requests through the Interceptor, which then uses the browser context to send requests. Cookies set inside the browser are automatically attached to your requests. Read the original blog post on Interceptor.

启用拦截器后,您还可以从邮差.只需设置Cookie"标头,就会发送 cookie与请求.您还可以访问返回响应时可用.查看博客文章更多

Once the interceptor is enabled, you can also send cookies from Postman. Just set the "Cookie" header, and the cookie will be sent with the request. You can also get access to cookies that are available when the response is returned. Check out out blog post for more

所以我下载了谷歌浏览器的拦截器,它启用了.

So I downloaded the interceptor for google chrome, and it enable.

另外,我向邮递员添加以下内容:Cookie JSESSIONID=daczcz36789

Also, I add the following to postman: Cookie JSESSIONID=daczcz36789

当我查看网络时,我注意到没有发送 Cookie.

When I look at the network I notice that the Cookie is not sent.

我做错了什么?

推荐答案

您可以在浏览器和 Postman 中分别启用 Interceptor.对于发送/接收 cookie,您应该在 Postman 中启用拦截器.因此,如果您仅在浏览器中启用拦截器 - 它将不起作用.实际上,您根本不需要在浏览器中启用拦截器 - 如果您不想用不必要的请求淹没您的邮递员历史记录.

You can enable Interceptor in browser and in Postman separately. For send/recieve cookies you should enable Interceptor in Postman. So if you enable interceptor only in browser - it will not work. Actually you don't need enable Interceptor in browser at all - if you don't want to flood your postman history with unnecessary requests.

这篇关于使用邮递员发送 cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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