Skip to content

Commit

Permalink
Prevent a cors failure to match to create a routing 404
Browse files Browse the repository at this point in the history
  • Loading branch information
David Porter committed Jul 1, 2015
1 parent 6e136af commit 6b1e002
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ module.exports = function getMiddleware(options) {
origin = options.origin(this.request);
}

if (origin === false) return;
if (origin === false) {
yield next;
return ;
}

this.set('Access-Control-Allow-Origin', origin);

Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('cors({ origin: [function]})', function() {
.end(function(response) {
chai.expect(response.get('Access-Control-Allow-Origin')).to.not.exist;
chai.expect(response.get('Access-Control-Allow-Methods')).to.not.exist;

chai.expect(response.statusCode).to.equal(200);
done();
});
});
Expand Down

0 comments on commit 6b1e002

Please sign in to comment.