@less-is-more/less-js 1.4.32-0 → 1.4.32-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/router.js +6 -9
package/package.json
CHANGED
package/src/router.js
CHANGED
|
@@ -212,18 +212,15 @@ module.exports = class Router {
|
|
|
212
212
|
const acceptEncoding =
|
|
213
213
|
req.headers["Accept-Encoding"] || req.headers["accept-encoding"];
|
|
214
214
|
if (acceptEncoding) {
|
|
215
|
-
if (
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (acceptEncoding.includes("gzip")) {
|
|
215
|
+
if (acceptEncoding.includes("br")) {
|
|
216
|
+
content = zlib.brotliCompressSync(content).toString("base64");
|
|
217
|
+
res.setHeader("Content-Encoding", "br");
|
|
218
|
+
} else if (acceptEncoding.includes("gzip")) {
|
|
219
219
|
content = zlib.gzipSync(content).toString("base64");
|
|
220
|
-
res.
|
|
220
|
+
res.setHeader("Content-Encoding", "gzip");
|
|
221
221
|
} else if (acceptEncoding.includes("deflate")) {
|
|
222
222
|
content = zlib.deflateSync(content).toString("base64");
|
|
223
|
-
res.
|
|
224
|
-
} else if (acceptEncoding.includes("br")) {
|
|
225
|
-
content = zlib.brotliCompressSync(content).toString("base64");
|
|
226
|
-
res.headers["Content-Encoding"] = "br";
|
|
223
|
+
res.setHeader("Content-Encoding", "deflate");
|
|
227
224
|
}
|
|
228
225
|
}
|
|
229
226
|
}
|