Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added If-None-Match: * support

  • Loading branch information...
commit f7ca0233f4a293c44ad1f68062668607c3d4c382 1 parent 78a846a
@tj tj authored
Showing with 9 additions and 1 deletion.
  1. +1 −1  index.js
  2. +8 −0 test/fresh.js
View
2  index.js
@@ -36,7 +36,7 @@ function fresh(req, res) {
if (noneMatch) noneMatch = noneMatch.split(/ *, */);
// if-none-match
- if (noneMatch) etagMatches = ~noneMatch.indexOf(etag);
+ if (noneMatch) etagMatches = ~noneMatch.indexOf(etag) || '*' == noneMatch[0];
// if-modified-since
if (modifiedSince) {
View
8 test/fresh.js
@@ -34,6 +34,14 @@ describe('fresh(reqHeader, resHeader)', function(){
fresh(req, res).should.be.false;
})
})
+
+ describe('when * is given', function(){
+ it('should be fresh', function(){
+ var req = { 'if-none-match': '*' };
+ var res = { 'etag': 'hey' };
+ fresh(req, res).should.be.true;
+ })
+ })
})
describe('when requested with If-Modified-Since', function(){
Please sign in to comment.
Something went wrong with that request. Please try again.