app.use(bodyParser.text())
function Middleware(logger, messageValidatorService) { this._logger = logger; this._stream = this._createStream(); this._buffer = null; this._app = express(); this._app.use(bodyParser.text({ type: "*/*" })); this._validateMessageSignature(messageValidatorService); this._configureEndpoints(); }
constructor() { const root = path.normalize(`${__dirname}/../..`); app.set('appPath', `${root}client`); app.use(bodyParser.json({ limit: process.env.REQUEST_LIMIT || '100kb' })); app.use( bodyParser.urlencoded({ extended: true, limit: process.env.REQUEST_LIMIT || '100kb', }) ); app.use(cors); app.use(bodyParser.text({ limit: process.env.REQUEST_LIMIT || '100kb' })); app.use(cookieParser(process.env.SESSION_SECRET)); app.use(Express.static(`${root}/public`)); app.use(errorHandler); }
//process refund notify result app.post('/refund-result-notify', bodyParser.text(), function(req, res) { wx.payment .decryptRefundNotifyResult(req.body) .then(result => { const parsedXMLData = result.parsedXMLData; const decryptedReqInfoData = result.decryptedData; order.updateNotifyRefundResult( Object.assign(parsedXMLData, decryptedReqInfoData) ); wx.payment.replyData(true).then(ret => { res.send(ret); }); }) .catch(err => { console.error(err); wx.payment.replyData(false).then(ret => { res.send(ret); }); }); });
/** * Parses the HTTP request into useful objects. * This middleware populates {@link Request#params}, {@link Request#headers}, {@link Request#cookies}, * {@link Request#signedCookies}, {@link Request#query}, {@link Request#body}, and {@link Request#files}. * * @param {requestParser.defaultOptions} [options] * @returns {function[]} */ function requestParser (options) { // Override default options options = _.merge({}, requestParser.defaultOptions, options); return [ cookieParser(options.cookie.secret, options.cookie), bodyParser.json(options.json), bodyParser.text(options.text), bodyParser.urlencoded(options.urlencoded), bodyParser.raw(options.raw), generateMultipartFormDataMiddleware(options.multipart), multerCompatability ]; }
app.post('/pay-result-notify', bodyParser.text(), function(req, res) { wx.payment .parseNotifyData(req.body)
this.webApp.use(bodyParser.text()); this.webApp.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json({ limit: REQUEST_SIZE_LIMIT })); app.use(bodyParser.text({ limit: REQUEST_SIZE_LIMIT })); app.use(bodyParser.raw({ limit: REQUEST_SIZE_LIMIT })); app.use(cookieParser());