gpt4 book ai didi

node.js - 从 super 代理响应 header 中检索和整理 cookie 数据

转载 作者:搜寻专家 更新时间:2023-10-31 23:54:52 24 4
gpt4 key购买 nike

我正在使用 supertest 并尝试干净地获取 cookie 数据

agent.post('/login').send('username:u','password:p').end(function(err, res) {
agent.cookie = res.req._headers.cookie;
});

但是我得到的cookie数据是乱七八糟的

connect.sid=s%3Afc20GaiFXGNju1rxqDSOEiA4.W3XfTacI0xhk4gQ9Bdh1LLC%2FlhjnAwVmQkUX%2F7%2FJEAo

而不是像这样干净利落(而且由于某种原因上面的甚至更长)

{ 'connect.sid': 'T0jrnU09DzCYN68FsgspuY5g' }

我如何获得后者?

最佳答案

require('cookie').parse(decodeURIComponent(cookie))

关于node.js - 从 super 代理响应 header 中检索和整理 cookie 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23751317/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com