84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
node.js平台express.js框架更新expreess.js为4后(也改了一些代码)接到支付宝回调req.body是{}之前可以正常收到并解析
模拟支付宝数据本地向服务器发送post请求,也是能解出body的微信支付能够正常回调,只有支付宝不行
请问这会是什么问题?
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
Problem solvedReferencehttp://ju.outofmemory.cn/entry/169748https://v2ex.com/t/170386https://cnodejs. org/topic/5566952ad4ca459f5267ac59
Option 1:
app.use(bodyParser.urlencoded({ type: function(req) { return /x-www-form-urlencoded/.test(req.headers['content-type']); }, extended: true }));
But I don’t understand what this type means. . . Convert all content-types to x-www-form-urlencoded? Isn’t this a problem?
Option 2: Or this, easier to understand (pay attention to the order of 3 app.users)
app.use(function (req, res, next){ if (req.url === 'your_alipay_notify_url') { req.headers['content-type'] = 'application/x-www-form-urlencoded'; } next(); }); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended:true}))
It’s usually a Content-Type problem
bing search keywords -> "Alipay notify_url Content-Type" third
https://v2ex.com/t/170386
Problem solved
Reference
http://ju.outofmemory.cn/entry/169748
https://v2ex.com/t/170386
https://cnodejs. org/topic/5566952ad4ca459f5267ac59
Option 1:
But I don’t understand what this type means. . .
Convert all content-types to x-www-form-urlencoded?
Isn’t this a problem?
Option 2:
Or this, easier to understand (pay attention to the order of 3 app.users)
It’s usually a Content-Type problem
bing search keywords -> "Alipay notify_url Content-Type" third
https://v2ex.com/t/170386