Comparing version 4.0.0 to 4.0.1
@@ -20,3 +20,3 @@ const { gzip } = require('zlib'); | ||
module.exports = function(options) { | ||
options = options || { compression: false }; | ||
options = options || {}; | ||
@@ -124,7 +124,3 @@ const hash = | ||
if ( | ||
options.compression && | ||
compressible(obj.type) && | ||
ctx.response.length >= threshold | ||
) { | ||
if (compressible(obj.type) && ctx.response.length >= threshold) { | ||
obj.gzip = await compress(body); | ||
@@ -131,0 +127,0 @@ if ( |
{ | ||
"name": "koa-cash", | ||
"description": "HTTP response caching for Koa. HTTP response caching for Koa. Supports Redis, in-memory store, and more!", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)", | ||
@@ -6,0 +6,0 @@ "ava": { |
@@ -33,3 +33,3 @@ # koa-cash | ||
* Handles JSON and stream bodies | ||
* Handles gzip compression negotiation (if `options.compression` is set to `true` as of v4.0.0) | ||
* Handles gzip compression negotiation | ||
* Handles 304 responses | ||
@@ -90,6 +90,2 @@ | ||
#### `compression` | ||
If a truthy value is passed, then compression will be enabled. This value is `false` by default. | ||
#### `hash()` | ||
@@ -96,0 +92,0 @@ |
@@ -19,4 +19,3 @@ const Koa = require('koa'); | ||
return c.set(key, value); | ||
}, | ||
compression: true | ||
} | ||
} | ||
@@ -40,4 +39,3 @@ ) | ||
return c.set(key, value); | ||
}, | ||
compression: true | ||
} | ||
}); | ||
@@ -176,4 +174,3 @@ | ||
return c.set(key, JSON.stringify(value)); | ||
}, | ||
compression: true | ||
} | ||
}); | ||
@@ -180,0 +177,0 @@ app.use(async function(ctx) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
23590
523
186