Skip to content

Commit

Permalink
Add If-Modified-Since header support.
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffano committed Apr 6, 2012
1 parent 64c34d9 commit 574f897
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/assetmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 574f897

Please sign in to comment.