Skip to content

Commit

Permalink
Merge pull request #66 from avdv/fix-proxying-problem
Browse files Browse the repository at this point in the history
Enable JSON body-parser for the coverage middleware only
  • Loading branch information
jschilli committed May 31, 2015
2 parents f14b8e9 + 47dea91 commit 3f7245c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
11 changes: 3 additions & 8 deletions lib/coverage-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
};
};

0 comments on commit 3f7245c

Please sign in to comment.