从快速服务器创建cookie并将其与响应一起发回

时间:2016-04-21 19:55:40

标签: express cookies

我正在玩并学习一点表达所以我正在使用与我的用户相关的一些数据发布到特定路线,并且我正在尝试从expressJs服务器创建一个cookie并将其与回复一起发回。但不幸的是没有发生任何事我正在和Postman一起测试这条路线,它告诉我:

No cookies were returned by the server

这是我正在尝试的方式

  res.status(200).cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: false }).send('Cookie sent...?');

我可能正在做或丢失一些愚蠢的东西,那么这有什么问题?请问任何想法??

1 个答案:

答案 0 :(得分:0)

If you use older version of Postman, the one that runs in the browser, you would be able to see the cookie.

However, the new one doesn't run in the browser anymore, it becomes a seperate chrome app, so it doesn't read browser cookies anymore. In order to see the cookie, you will need to install the postman interceptor

enter image description here