1.浏览器默认方式form-urlencodes
2.json请求

后面设置请求参数

app.use(function(req, res, next){
//设置跨域访问
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild');
res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');

if (req.method == 'OPTIONS') {
    res.send(200); /*让options请求快速返回*/
}else {
    next();
}

})

设置跨域请求头

相关文章:

  • 2021-11-22
  • 2021-11-17
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
猜你喜欢
  • 2021-12-19
  • 2022-01-07
  • 2022-12-23
  • 2021-12-26
  • 2021-07-03
  • 2021-07-11
相关资源
相似解决方案