[英]Passing header along with res redirect without using query strings
我想在重定向到特定路由后设置标题。
app.post('/signup', (req,res) => {
var user = new User(req.body);
req.method = 'get';
// console.log(req.body);
user.save().then((doc) => {
console.log("hi");
return user.generateAuthToken().then((token) => {
res.header('x-auth',token);
res.redirect('home.hbs');
});
})
});
我想在不使用查询字符串的情况下将令牌作为标头传递。 怎么可能呢?
在HTTP中,重定向响应提供了供用户代理请求的URL。 它没有指定其余的请求。
但是,如果重定向目标位于同一域中,则可以设置cookie。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.