@
rankjie 我按照你的方法试了,确实content-type像你所说的那样,但改过以后还是不行啊:
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(function(req, res, next){
if(req.url == '/alipay/notify' && req.get('content-type') != 'application/x-www-form-urlencoded')
req.headers['content-type'] = 'application/x-www-form-urlencoded';
console.log(req.headers['content-type']); // 打印 application/x-www-form-urlencoded
next();
});
app.use(bodyParser.urlencoded({extended:true}))
app.use(bodyParser.json());