diff --git a/lib/read.js b/lib/read.js index b04c8bc3..0804182a 100644 --- a/lib/read.js +++ b/lib/read.js @@ -27,7 +27,7 @@ module.exports = read * @const * whether current node version has brotli support */ -var hasBrotliSupport = 'brotli' in process.versions +var hasBrotliSupport = 'createBrotliDecompress' in zlib /** * Read a request into a buffer and parse. diff --git a/test/json.js b/test/json.js index 87185a8d..be5ae487 100644 --- a/test/json.js +++ b/test/json.js @@ -10,7 +10,7 @@ var bodyParser = require('..') * @const * whether current node version has brotli support */ -var hasBrotliSupport = 'brotli' in process.versions +var hasBrotliSupport = 'createBrotliDecompress' in require('zlib') describe('bodyParser.json()', function () { it('should parse JSON', function (done) { diff --git a/test/raw.js b/test/raw.js index 71c6d5ff..7418ae99 100644 --- a/test/raw.js +++ b/test/raw.js @@ -10,7 +10,7 @@ var bodyParser = require('..') * @const * whether current node version has brotli support */ -var hasBrotliSupport = 'brotli' in process.versions +var hasBrotliSupport = 'createBrotliDecompress' in require('zlib') describe('bodyParser.raw()', function () { before(function () { diff --git a/test/text.js b/test/text.js index 7c50a8c0..19bc89f9 100644 --- a/test/text.js +++ b/test/text.js @@ -10,7 +10,7 @@ var bodyParser = require('..') * @const * whether current node version has brotli support */ -var hasBrotliSupport = 'brotli' in process.versions +var hasBrotliSupport = 'createBrotliDecompress' in require('zlib') describe('bodyParser.text()', function () { before(function () { diff --git a/test/urlencoded.js b/test/urlencoded.js index f8042796..e26b206b 100644 --- a/test/urlencoded.js +++ b/test/urlencoded.js @@ -10,7 +10,7 @@ var bodyParser = require('..') * @const * whether current node version has brotli support */ -var hasBrotliSupport = 'brotli' in process.versions +var hasBrotliSupport = 'createBrotliDecompress' in require('zlib') describe('bodyParser.urlencoded()', function () { before(function () {