diff --git a/README.md b/README.md index b1dab4b..31c09d5 100644 --- a/README.md +++ b/README.md @@ -430,7 +430,7 @@ If no values are set, the following request headers will be sent automatically: | Header | Value | | ------------------- | -------------------------------------------------------- | -| `Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_ | +| `Accept-Encoding` | `gzip,deflate,br` _(when `options.compress === true`)_ | | `Accept` | `*/*` | | `Connection` | `close` _(when no `options.agent` is present)_ | | `Content-Length` | _(automatically calculated, if possible)_ | diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 2655ba6..e60f261 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,6 +7,7 @@ Changelog **Work in progress!** +- **Breaking:** minimum supported Node.js version is now 10.16. - Enhance: improve coverage. - Enhance: drop Babel (while keeping ESM) (#805). - Fix: export the `AbortError` class. diff --git a/docs/v3-UPGRADE-GUIDE.md b/docs/v3-UPGRADE-GUIDE.md index 8399959..6a31554 100644 --- a/docs/v3-UPGRADE-GUIDE.md +++ b/docs/v3-UPGRADE-GUIDE.md @@ -19,7 +19,7 @@ other comparatively minor modifications. # Breaking Changes -## Minimum supported Node.js version is now 10 +## Minimum supported Node.js version is now 10.16 Since Node.js will deprecate version 8 at the end of 2019, we decided that node-fetch v3.x will not only drop support for Node.js 4 and 6 (which were supported in v2.x), but also for Node.js 8. We strongly encourage you to upgrade, if you still haven't done so. Check out Node.js' official [LTS plan] for more information on Node.js' support lifetime. diff --git a/package.json b/package.json index 2e30be0..6df7ee1 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "*.d.ts" ], "engines": { - "node": ">=10" + "node": ">=10.16" }, "scripts": { "build": "rollup -c", diff --git a/src/index.js b/src/index.js index 8cac021..e0773c3 100644 --- a/src/index.js +++ b/src/index.js @@ -284,7 +284,7 @@ export default function fetch(url, options_) { } // For br - if (codings === 'br' && typeof zlib.createBrotliDecompress === 'function') { + if (codings === 'br') { body = pump(body, zlib.createBrotliDecompress(), error => { reject(error); }); diff --git a/src/request.js b/src/request.js index 6ccdec7..b2dad8d 100644 --- a/src/request.js +++ b/src/request.js @@ -239,7 +239,7 @@ export function getNodeRequestOptions(request) { // HTTP-network-or-cache fetch step 2.15 if (request.compress && !headers.has('Accept-Encoding')) { - headers.set('Accept-Encoding', 'gzip,deflate'); + headers.set('Accept-Encoding', 'gzip,deflate,br'); } let {agent} = request;