这个 http 400 错误的根本原因是什么?设置是 REST API NodeJs +Mysql 。所以这里是我所处位置的摘要:
请参阅下面的关键代码部分:
<块引用> Module.exports = (req, res, next){
const token = req.Headers.Authorization.split(" ")[1];
//const token2 = req.body.token; /*this worked!*/
const decoded = jwt.verify(token, process.env.SECRET);
req.udata = decoded;
}
Postman 中的原始正文 JSON 输入是:
> {
> "project_Id" : 2,
> "lots" : [
> {
> "sn" : "1",
> "lotname" : "Consultancy Project NASA",
> "value" : "N10m",
> "status" : "awarded"
> },
> {
> "sn" : "1",
> "lotname" : "Consultancy Project NASA",
> "value" : "N10m",
> "status" : "awarded"
> }
> ],
> "applicant_Id" : 4,
> "pitch" : "I am the best, you are will be sorry if you do not take me" }
最后是 Postman 屏幕: