Comparing version 2.0.0 to 2.1.0
15
index.js
@@ -5,3 +5,2 @@ 'use strict' | ||
const toArray = require('stream-to-array') | ||
const compress = require('mz/zlib').gzip | ||
const isJSON = require('koa-is-json') | ||
@@ -11,6 +10,8 @@ const Bluebird = require('bluebird') | ||
const compress = Bluebird.promisify(require('zlib').gzip) | ||
// methods we cache | ||
const methods = { | ||
HEAD: true, | ||
GET: true, | ||
GET: true | ||
} | ||
@@ -52,5 +53,4 @@ | ||
if (obj.gzip | ||
&& this.request.acceptsEncodings('gzip', 'identity') === 'gzip') { | ||
this.response.body = obj.gzip | ||
if (obj.gzip && this.request.acceptsEncodings('gzip', 'identity') === 'gzip') { | ||
this.response.body = new Buffer(obj.gzip) | ||
this.response.set('Content-Encoding', 'gzip') | ||
@@ -107,3 +107,3 @@ } else { | ||
lastModified: this.response.lastModified || null, | ||
etag: this.response.get('etag') || null, | ||
etag: this.response.get('etag') || null | ||
} | ||
@@ -113,4 +113,3 @@ | ||
obj.gzip = yield compress(body) | ||
if (!fresh | ||
&& this.request.acceptsEncodings('gzip', 'identity') === 'gzip') { | ||
if (!fresh && this.request.acceptsEncodings('gzip', 'identity') === 'gzip') { | ||
this.response.body = obj.gzip | ||
@@ -117,0 +116,0 @@ this.response.set('Content-Encoding', 'gzip') |
{ | ||
"name": "koa-cash", | ||
"description": "HTTP response caching for Koa", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"dependencies": { | ||
"bluebird": "^3.1.1", | ||
"bytes": "^2.1.0", | ||
"compressible": "2", | ||
"koa-is-json": "1", | ||
"mz": "^2.0.0", | ||
"stream-to-array": "2" | ||
"compressible": "^2.0.0", | ||
"koa-is-json": "^1.0.0", | ||
"stream-to-array": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"babel-eslint": "^4.1.6", | ||
"eslint": "^1.10.3", | ||
"eslint-config-jongleberry": "^1.2.3", | ||
"eslint-plugin-react": "^3.15.0", | ||
"eslint-plugin-standard": "^1.3.1", | ||
"istanbul": "0", | ||
"koa": "1", | ||
"istanbul": "^0.4.2", | ||
"koa": "^1.0.0", | ||
"lru-cache": "^4.0.0", | ||
"mocha": "^2.3.3", | ||
"mocha": "^3.1.2", | ||
"standard": "^7.0.0", | ||
"supertest": "^1.1.0" | ||
}, | ||
"scripts": { | ||
"lint": "eslint index.js test", | ||
"lint": "standard index.js test/**/*.js", | ||
"test": "NODE_ENV=test mocha", | ||
@@ -28,0 +23,0 @@ "test-cov": "NODE_ENV=test node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5
6
9741
97
1
- Removedmz@^2.0.0
- Removedmz@2.7.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedthenify@3.3.1(transitive)
- Removedthenify-all@1.6.0(transitive)
Updatedcompressible@^2.0.0
Updatedkoa-is-json@^1.0.0
Updatedstream-to-array@^2.0.0