Skip to content
This repository has been archived by the owner on Aug 19, 2019. It is now read-only.

Commit

Permalink
Also stop require of 'body-parser' unless it is used
Browse files Browse the repository at this point in the history
  • Loading branch information
thepont committed Sep 19, 2017
1 parent 2195aa7 commit 2779169
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/middleware.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

var bodyParser = require('body-parser'),
cookieParser = require('cookie-parser'),
var cookieParser = require('cookie-parser'),
flash = require('express-flash'),
helmet = require('helmet'),
compression = require('compression'),
Expand Down Expand Up @@ -41,6 +40,7 @@ module.exports = function (done, app, options) {
}
var _bodyParserOptions = middlewareOptions('bodyParser', options);
if (options.bodyParser !== false) {
var bodyParser = require('body-parser');
app.use(bodyParser.json(_bodyParserOptions.json));
app.use(bodyParser.urlencoded(_bodyParserOptions.urlencoded));
}
Expand Down
4 changes: 2 additions & 2 deletions src/middleware.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

var bodyParser = require('body-parser'),
cookieParser = require('cookie-parser'),
var cookieParser = require('cookie-parser'),
flash = require('express-flash'),
helmet = require('helmet'),
compression = require('compression'),
Expand Down Expand Up @@ -41,6 +40,7 @@ module.exports = function(done, app, options) {
}
var _bodyParserOptions = middlewareOptions('bodyParser', options);
if (options.bodyParser !== false) {
var bodyParser = require('body-parser');
app.use(bodyParser.json(_bodyParserOptions.json));
app.use(bodyParser.urlencoded(_bodyParserOptions.urlencoded));
}
Expand Down

0 comments on commit 2779169

Please sign in to comment.