Skip to content

Commit

Permalink
Use etag to generate ETag header
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Aug 25, 2014
1 parent e597da9 commit b251cb9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
@@ -1,3 +1,8 @@
unreleased
==========

* Use `etag` to generate `ETag` header

2.0.1 / 2014-06-05
==================

Expand Down
10 changes: 1 addition & 9 deletions index.js
Expand Up @@ -10,7 +10,7 @@
* Module dependencies.
*/

var crypto = require('crypto');
var etag = require('etag');
var fresh = require('fresh');
var fs = require('fs');
var path = require('path');
Expand Down Expand Up @@ -91,14 +91,6 @@ function createIsDirError(path) {
return error;
}

function etag(buf){
var hash = crypto
.createHash('md5')
.update(buf)
.digest('base64');
return '"' + hash + '"';
}

function send(req, res, icon){
var _fresh = fresh(req.headers, icon.headers);
var buf = _fresh ? '' : icon.body;
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -11,6 +11,7 @@
],
"repository": "expressjs/serve-favicon",
"dependencies": {
"etag": "~1.2.0",
"fresh": "0.2.2"
},
"devDependencies": {
Expand Down

0 comments on commit b251cb9

Please sign in to comment.