Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Send "Vary: Origin" when using regular expressions
closes #105
fixes #106
  • Loading branch information
tkopczuk authored and dougwilson committed Mar 26, 2017
1 parent 72e7517 commit 6d2ff29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 4 additions & 6 deletions lib/index.js
Expand Up @@ -61,12 +61,10 @@
key: 'Access-Control-Allow-Origin',
value: isAllowed ? requestOrigin : false
}]);
if (isAllowed) {
headers.push([{
key: 'Vary',
value: 'Origin'
}]);
}
headers.push([{
key: 'Vary',
value: 'Origin'
}]);
}

return headers;
Expand Down
3 changes: 2 additions & 1 deletion test/cors.js
Expand Up @@ -247,7 +247,8 @@
cors(options)(req, res, function(err) {
should.not.exist(err);
should.not.exist(res.getHeader('Access-Control-Allow-Origin'));
should.not.exist(res.getHeader('Vary'));
should.exist(res.getHeader('Vary'));
res.getHeader('Vary').should.equal('Origin');
return done();
});
});
Expand Down

0 comments on commit 6d2ff29

Please sign in to comment.