koa-spdy-push
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -43,2 +43,3 @@ | ||
&& (typeof length !== 'number' || length > threshold) | ||
&& !headers['content-encoding'] | ||
&& filter(headers['content-type']) | ||
@@ -45,0 +46,0 @@ if (compress) |
{ | ||
"name": "koa-spdy-push", | ||
"description": "SPDY Push helper for Koa", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"author": { | ||
@@ -21,5 +21,7 @@ "name": "Jonathan Ong", | ||
"co": "3", | ||
"mz": "*", | ||
"koa": "*", | ||
"raw-body": "*", | ||
"mocha": "*", | ||
"should": "*", | ||
"should": "3", | ||
"supertest": "*", | ||
@@ -26,0 +28,0 @@ "spdy": "1", |
@@ -8,2 +8,4 @@ | ||
var join = require('path').join | ||
var zlib = require('mz/zlib') | ||
var get = require('raw-body') | ||
var koa = require('koa') | ||
@@ -162,3 +164,27 @@ var fs = require('fs') | ||
describe('Buffers', function () { | ||
describe('when already compress', function () { | ||
it('should not compress', co(function* () { | ||
yield listen(koa().use(function* () { | ||
this.status = 204 | ||
push({ | ||
threshold: 1 | ||
})(this, { | ||
path: '/', | ||
headers: { | ||
'content-encoding': 'gzip', | ||
'content-type': 'text/plain' | ||
}, | ||
body: yield zlib.gzip('lol') | ||
}) | ||
})) | ||
var res = yield pull | ||
res.should.have.header('Content-Encoding', 'gzip') | ||
res.should.have.header('Content-Type', 'text/plain') | ||
var buffer = yield get(res) | ||
buffer.toString('utf8').should.equal('lol') | ||
})) | ||
}) | ||
}) | ||
@@ -197,5 +223,5 @@ | ||
.once('response', function (res) { | ||
if (res.statusCode !== 204) done(new Error('wtf')) | ||
if (res.statusCode !== 204) done(new Error('got status code: ' + res.statusCode)) | ||
}) | ||
.end() | ||
} |
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
12219
299
9