feat: #7760, body-parser config

v1.18.x
Barış Soner Uşaklı 6 years ago
parent b110aec6ed
commit 5de6d8857a

@ -143,8 +143,8 @@ function setupExpressApp(app) {
app.use(relativePath + '/apple-touch-icon', middleware.routeTouchIcon);
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
configureBodyParser(app);
app.use(cookieParser());
const userAgentMiddleware = useragent.express();
app.use(function userAgent(req, res, next) {
@ -192,6 +192,17 @@ function setupFavicon(app) {
}
}
function configureBodyParser(app) {
const urlencodedOpts = nconf.get('bodyParser:urlencoded') || {};
if (!urlencodedOpts.hasOwnProperty('extended')) {
urlencodedOpts.extended = true;
}
app.use(bodyParser.urlencoded(urlencodedOpts));
const jsonOpts = nconf.get('bodyParser:json') || {};
app.use(bodyParser.json(jsonOpts));
}
function setupCookie() {
var ttl = meta.getSessionTTLSeconds() * 1000;

Loading…
Cancel
Save