Browse Source

Use default function paramter for options object

pull/32/head
Luke Childs 6 years ago
parent
commit
987d4e3929
  1. 10
      src/index.js
  2. 5643
      yarn.lock

10
src/index.js

@ -7,7 +7,7 @@ const pify = require('pify');
const createCert = require('create-cert'); const createCert = require('create-cert');
const bodyParser = require('body-parser'); const bodyParser = require('body-parser');
const createTestServer = opts => createCert(opts && opts.certificate) const createTestServer = (opts = {}) => createCert(opts.certificate)
.then(keys => { .then(keys => {
const app = express(); const app = express();
const get = app.get.bind(app); const get = app.get.bind(app);
@ -24,10 +24,10 @@ const createTestServer = opts => createCert(opts && opts.certificate)
}; };
app.set('etag', false); app.set('etag', false);
app.use(bodyParser.json(Object.assign({ limit: '1mb', type: 'application/json' }, opts && opts.bodyParser))); app.use(bodyParser.json(Object.assign({ limit: '1mb', type: 'application/json' }, opts.bodyParser)));
app.use(bodyParser.text(Object.assign({ limit: '1mb', type: 'text/plain' }, opts && opts.bodyParser))); app.use(bodyParser.text(Object.assign({ limit: '1mb', type: 'text/plain' }, opts.bodyParser)));
app.use(bodyParser.urlencoded(Object.assign({ limit: '1mb', type: 'application/x-www-form-urlencoded', extended: true }, opts && opts.bodyParser))); app.use(bodyParser.urlencoded(Object.assign({ limit: '1mb', type: 'application/x-www-form-urlencoded', extended: true }, opts.bodyParser)));
app.use(bodyParser.raw(Object.assign({ limit: '1mb', type: 'application/octet-stream' }, opts && opts.bodyParser))); app.use(bodyParser.raw(Object.assign({ limit: '1mb', type: 'application/octet-stream' }, opts.bodyParser)));
app.caCert = keys.caCert; app.caCert = keys.caCert;
app.listen = () => Promise.all([ app.listen = () => Promise.all([

5643
yarn.lock

File diff suppressed because it is too large
Loading…
Cancel
Save