Postman 中的 Cookie 与 Set-Cookie 标头Postman、Cookie、Set

2023-09-07 10:50:33 作者:懷念那年夏天

为什么 Postman(chrome 扩展)不支持更传统的Set-Cookie"标头.我尝试使用Set-Cookie"作为键和cookie_name=cookie_value"作为值发送 cookie,但服务器没有获取 cookie 信息.

Why doesn't Postman (chrome extension) support more traditional "Set-Cookie" header. I have tried sending cookies using "Set-Cookie" as key and "cookie_name=cookie_value" as value, but server did not get the cookie information.

我用Cookie"作为键重试,它成功了.

I retried with "Cookie" as the key and it worked.

看起来它支持Cookie"标头.为什么是Cookie"和Cookie 2"而不是更传统的Set-Cookie"?

It looks like it supports "Cookie" header instead. Why "Cookie" and "Cookie 2" instead of more traditional "Set-Cookie"?

推荐答案

通常消费者(无论是浏览器还是邮递员)通过 Cookie 标头向服务器发送 cookie.

Usually a consumer (be it a browser or Postman) sends cookies to the server via the Cookie header.

想要通知消费者设置 cookie 的服务器将通过 Set-Cookie 标头发送它.

A server that wants to inform a consumer to set a cookie, will send it via the Set-Cookie header.

来源:思科在其问答文章