Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add If-Modified-Since header support.

  • Loading branch information...
commit 574f897ec0046bddda916bb718894cab13cfe2a2 1 parent 64c34d9
@cliffano cliffano authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/assetmanager.js
View
10 lib/assetmanager.js
@@ -396,8 +396,14 @@ module.exports = function assetManager (assets) {
headers['Content-Encoding'] = response.encoding
}
- res.writeHead(200, headers);
- res.end(response.contentBuffer);
+ if (req.headers['if-modified-since'] &&
+ Date.parse(req.headers['if-modified-since']) >= Date.parse(response.modified)) {
+ res.writeHead(304, headers);
+ res.end();
+ } else {
+ res.writeHead(200, headers);
+ res.end(response.contentBuffer);
+ }
}
return;
}
Please sign in to comment.
Something went wrong with that request. Please try again.