84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
node.js平台express.js框架更新expreess.js为4后(也改了一些代码)接到支付宝回调req.body是{}之前可以正常收到并解析
模拟支付宝数据本地向服务器发送post请求,也是能解出body的微信支付能够正常回调,只有支付宝不行
请问这会是什么问题?
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
问题解决了参考了http://ju.outofmemory.cn/entry/169748https://v2ex.com/t/170386https://cnodejs.org/topic/5566952ad4ca459f5267ac59
方案一:
app.use(bodyParser.urlencoded({ type: function(req) { return /x-www-form-urlencoded/.test(req.headers['content-type']); }, extended: true }));
不过并不理解这个type是什么意思。。。把所有content-type都转成x-www-form-urlencoded吗?这样不会有问题吗?
方案二:或者是这样,比较好理解(3个app.user注意顺序)
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}))
一般是Content-Type问题
bing搜索关键字 -> "支付宝 notify_url Content-Type" 第三个
https://v2ex.com/t/170386
问题解决了
参考了
http://ju.outofmemory.cn/entry/169748
https://v2ex.com/t/170386
https://cnodejs.org/topic/5566952ad4ca459f5267ac59
方案一:
不过并不理解这个type是什么意思。。。
把所有content-type都转成x-www-form-urlencoded吗?
这样不会有问题吗?
方案二:
或者是这样,比较好理解(3个app.user注意顺序)
一般是Content-Type问题
bing搜索关键字 -> "支付宝 notify_url Content-Type" 第三个
https://v2ex.com/t/170386