diff --git a/index.js b/index.js index f146812..8d0072b 100644 --- a/index.js +++ b/index.js @@ -39,9 +39,10 @@ module.exports = { }, middleware: function(app, options) { - app.use(bodyParser.json()); - app.use(coverageMiddleware(options)); - app.use(logErrors); + app.post('/write-blanket-coverage', + bodyParser.json(), + coverageMiddleware(options), + logErrors); }, testemMiddleware: function(app) { this.middleware(app, { root: this.project.root }); diff --git a/lib/coverage-middleware.js b/lib/coverage-middleware.js index 3950f0e..e588bfa 100644 --- a/lib/coverage-middleware.js +++ b/lib/coverage-middleware.js @@ -33,13 +33,8 @@ module.exports = function(options) { var blanketOptions = loadBlanketOptions(options); var reporter = loadReporter(blanketOptions); - return function(req, res, next) { - // TODO: optionize url - if (req.method === 'POST' && req.url === '/write-blanket-coverage') { - reporter.report(req.body); - res.status(200).send('all good'); - } else { - next(); - } + return function(req, res) { + reporter.report(req.body); + res.status(200).send('all good'); }; };