express-static-gzip
Advanced tools
Comparing version
@@ -0,0 +0,0 @@ // Type definitions for express-static-gzip 2.0 |
@@ -0,0 +0,0 @@ let fs = require("fs"); |
@@ -0,0 +0,0 @@ MIT License |
{ | ||
"name": "express-static-gzip", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "simple wrapper on top of express.static, that allows serving pre-gziped files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,2 +5,3 @@ | ||
[![npm][npm-version-image]][npm-url] | ||
 | ||
[![npm][npm-downloads-image]][npm-url] | ||
@@ -7,0 +8,0 @@ [![Donate][donate-paypal-image]][donate-url] |
@@ -0,0 +0,0 @@ const expect = require('chai').expect; |
@@ -68,2 +68,12 @@ const expect = require('chai').expect; | ||
}); | ||
it('should treat identity as null', function () { | ||
const result = findEncoding('identity;q=1, gzip;q=0.5', [GZIP]); | ||
expect(result).to.be.null; | ||
}); | ||
it('should not use encodings with q=0', function () { | ||
const result = findEncoding('br;q=1, *;q=0', [GZIP]); | ||
expect(result).to.be.null; | ||
}); | ||
}); |
@@ -0,0 +0,0 @@ const expect = require('chai').expect; |
// see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding | ||
// Indicates the identity function (i.e. no compression, nor modification) | ||
const IDENTITY = 'identity'; | ||
/** | ||
@@ -21,2 +24,5 @@ * | ||
for (const encoding of sortedEncodingList) { | ||
if (encoding === IDENTITY) { | ||
return null; | ||
} | ||
for (let i = 0; i < availableCompressions.length; i++) { | ||
@@ -62,2 +68,3 @@ if (encoding === '*' || encoding === availableCompressions[i].encodingName) { | ||
.sort((encodingA, encodingB) => encodingB.q - encodingA.q) | ||
.filter(encoding => encoding.q > 0) | ||
.map(encoding => encoding.name); | ||
@@ -90,2 +97,2 @@ } | ||
findEncoding: findEncoding | ||
}; | ||
}; |
@@ -0,0 +0,0 @@ module.exports = { |
Sorry, the diff of this file is not supported yet
701
2.19%149
0.68%40151
-0.84%