Comparing version 7.3.0 to 7.3.1
{ | ||
"name": "bent", | ||
"version": "7.3.0", | ||
"version": "7.3.1", | ||
"description": "Functional HTTP client for Node.js w/ async/await.", | ||
@@ -5,0 +5,0 @@ "main": "src/nodejs.js", |
@@ -35,3 +35,5 @@ 'use strict' | ||
if (compression[enc]) { | ||
resp = resp.pipe(compression[enc]()) | ||
const decompress = compression[enc]() | ||
decompress.on('error', (e) => ret.emit('error', new Error('ZBufError', e))) | ||
resp = resp.pipe(decompress) | ||
} else { | ||
@@ -127,2 +129,3 @@ break | ||
res = getResponse(res) | ||
res.on('error', reject) | ||
decodings(res) | ||
@@ -129,0 +132,0 @@ res.status = res.statusCode |
@@ -6,2 +6,5 @@ 'use strict' | ||
const assert = require('assert') | ||
const zlib = require('zlib') | ||
const ttype = (e, str) => same(e.constructor.name, str) | ||
const qs = require('querystring') | ||
@@ -11,4 +14,2 @@ const test = it | ||
const ttype = (e, str) => same(e.constructor.name, str) | ||
test('Invalid encoding', done => { | ||
@@ -103,1 +104,24 @@ try { | ||
}) | ||
if (!process.browser) { | ||
test('Z_BUF_ERROR error', async () => { | ||
const request = bent('json') | ||
try { | ||
await request('https://echo-server.mikeal.now.sh/src/echo.js?headers=content-encoding%3Agzip%2Ccontent-type%3Aapplication%2Fjson') | ||
} catch (e) { | ||
ttype(e, 'Error') | ||
return e | ||
} | ||
}) | ||
test('gzip json compresssion SyntaxError', async () => { | ||
const request = bent('json') | ||
const base64 = zlib.gzipSync('ok').toString('base64') | ||
const headers = 'content-encoding:gzip,content-type:application/json' | ||
try { | ||
await request(`https://echo-server.mikeal.now.sh/src/echo.js?${qs.stringify({ base64, headers })}`) | ||
} catch (e) { | ||
ttype(e, 'SyntaxError') | ||
return e | ||
} | ||
}) | ||
} |
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
24500
623