首页 文章

如何在Postman中删除会话cookie?

提问于
浏览
78

我在Postman中测试我的API并且在模拟 log out 时遇到问题 .

如果我打电话删除会话cookie,
postman request

会话cookie之后是 still there ,我仍然可以访问需要身份验证的路由 .

服务器上的路由处理程序是:

server.route({
    method: 'DELETE',
    path: '/sessions/_current',
    handler: function(req, reply){
      req.auth.session.clear();
      reply({}).code(204);
    }
  });

这是与Hapi的Node.js,但它应该无关紧要 .

在邮差或_1849116中有没有办法 delete all the cookies

9 回答

  • 0

    在Chrome浏览器中手动删除它会从Postman中删除cookie .

    在Chrome浏览器中转到 chrome://settings/cookies

    找到cookie并删除它

    Edit: 根据下面的Max890评论(在我的谷歌浏览器版本(版本63)中)现在是 chrome://settings/content/cookies 然后转到"See all cookies and site data"

  • 58

    Postman 4.0.5在“发送”按钮下方有一个名为“管理Cookies”的功能,可以单独管理与Chrome相似的cookie .

    enter image description here

  • 5

    是否启用了邮差拦截器?切换它将通过Chrome浏览器路由所有请求和响应 .

    拦截器 - https://www.getpostman.com/docs/capture Cookies文档 - http://blog.getpostman.com/index.php/2014/11/28/using-the-interceptor-to-read-and-write-cookies/

  • 61

    Native Postman应用程序中有"Cookie manager",所以这根本不是问题,

    But in the Postman extension for Chrome there is not

    所以解决方案就是安装本机Postman

    Postman for Linux, Mac & Windows

  • 6

    正如@markus所说,使用"Cookie Manager"并删除cookie .
    enter image description here

    如果你想学习如何在postman中设置破坏cookie,你应该检查Postman Echo服务https://docs.postman-echo.com/

    在那里,您将找到有关如何设置,获取和删除这些cookie的完整说明 .

    检查一下:https://docs.postman-echo.com/#3de3b135-b3cc-3a68-ba27-b6d373e03c8c

    试试看 .

  • 0

    你试过Clear Cache extension吗?试试看 . 它清除应用程序设置中提供的应用程序缓存,下载,文件系统,表单数据,历史记录,本地存储,密码等等 .

    Update :试试这个答案https://superuser.com/a/232794

    我不确定在Postman中这样做的方法 . 我曾经关闭整个浏览器并重置服务器以便再次进行身份验证 . 从未测试过注销,因为它是一个API服务 .

  • 0

    进入Chrome,右键单击 - >检查元素 . 转到标签主动跟踪资源,如果还没有 . 现在左侧边栏有点向下,直到您看到“Cookies”,点击您的域名下方并删除cookie只需右键单击它并“删除”

  • 2

    您可以使用Postman拦截器 . 您可以通过此链接添加到chrome扩展中:https://chrome.google.com/webstore/detail/postman-interceptor/aicmkgpgakddgnaphhhpliifpcfhicfo

    这有助于您通过Postman应用程序发送使用浏览器cookie的请求 . 它还可以发送通常受Chrome限制但对测试API至关重要的标头 .

    你也可以通过橙色同步图标旁边的拦截器启用
    And also you can enable by interceptor which is there beside the orange sync icon.

  • 0

    请注意,此答案仅适用于 standalone Postman UI 而不适用于Chrome的Postman应用程序/插件 .

    How to clear the cache in Postman (so that you are required to log in again when requesting a token, for example):

    • 导航到View:Show DevTools

    • 导航到“应用程序”选项卡,然后导航到左侧菜单中的“清除存储”视图

    • 取消选择除缓存存储之外的所有选项,然后单击“清除网站数据”

    • 重启邮差

    • 现在,在请求新令牌时,系统会提示您再次登录

相关问题