Skip to content

Commit

Permalink
Adding legacy fix and test for #14
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgco committed Dec 21, 2011
1 parent bffc5a0 commit 17bacdc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions lib/staticGzip.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,19 @@ exports = module.exports = function staticGzip(dirPath, options){
contentType = contentType + (charset ? '; charset=' + charset : '');
acceptEncoding = req.headers['accept-encoding'] || '';

if (!contentTypeMatch.test(contentType)) {
return pass(filename);
}

if (!~acceptEncoding.indexOf('gzip')) {
return pass(filename);
}

//This is storing in memory for the moment, need to think what the best way to do this.
//Check file is not a directory

fs.stat(filename, function(err, stat) {
if (err || stat.isDirectory()) {
return pass(req.url);
}

if (!contentTypeMatch.test(contentType)) {
return pass(filename);
}

if (!~acceptEncoding.indexOf('gzip')) {
return pass(filename);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name" : "gzippo",
"version" : "0.0.7",
"version" : "0.0.8",
"author" : "Tom Gallacher",
"description" : "Gzip middleware for Connect using Compress for better performace.",
"homepage" : "http://www.tomg.co/gzippo",
Expand Down
Empty file added test/fixtures/js/nestedTest.js
Empty file.
2 changes: 1 addition & 1 deletion test/staticGzipTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ module.exports = {
);
},
'Ensuring that when viewing a directory a redirect works correctly': function() {
assert.response(getApp(),
assert.response(app,
{
url: '/js'
},
Expand Down

0 comments on commit 17bacdc

Please sign in to comment.