node-fetch/src/index.js

315 lines
8.7 KiB
JavaScript
Raw Normal View History

2015-01-26 01:02:34 -08:00
/**
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
* Index.js
2015-01-26 01:02:34 -08:00
*
2015-01-27 05:11:26 -08:00
* a request API compatible with window.fetch
2018-03-04 19:38:57 -08:00
*
* All spec algorithm step numbers are based on https://fetch.spec.whatwg.org/commit-snapshots/ae716822cb3a61843226cd090eefc6589446c1d2/.
2015-01-26 01:02:34 -08:00
*/
import http from 'http';
import https from 'https';
import zlib from 'zlib';
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
import Stream, {PassThrough, pipeline as pump} from 'stream';
import dataURIToBuffer from 'data-uri-to-buffer';
import Body, {writeToStream, getTotalBytes} from './body.js';
import Response from './response.js';
import Headers, {createHeadersLenient} from './headers.js';
import Request, {getNodeRequestOptions} from './request.js';
import FetchError from './errors/fetch-error.js';
import AbortError from './errors/abort-error.js';
export {default as Headers} from './headers.js';
export {default as Request} from './request.js';
export {default as Response} from './response.js';
export {default as FetchError} from './errors/fetch-error.js';
export {default as AbortError} from './errors/abort-error.js';
2015-01-26 01:02:34 -08:00
/**
* Fetch function
2015-01-26 01:02:34 -08:00
*
2015-06-03 21:05:01 -07:00
* @param Mixed url Absolute url or Request instance
2015-01-26 01:02:34 -08:00
* @param Object opts Fetch options
* @return Promise
*/
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
export default function fetch(url, options_) {
// Allow custom promise
if (!fetch.Promise) {
throw new Error('native promise missing, set fetch.Promise to your favorite alternative');
2015-01-26 02:15:07 -08:00
}
2015-01-26 01:02:34 -08:00
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// Regex for data uri
const dataUriRegex = /^\s*data:([a-z]+\/[a-z]+(;[a-z-]+=[a-z-]+)?)?(;base64)?,[\w!$&',()*+;=\-.~:@/?%\s]*\s*$/i;
// If valid data uri
if (dataUriRegex.test(url)) {
const data = dataURIToBuffer(url);
const res = new Response(data, {headers: {'Content-Type': data.type}});
return fetch.Promise.resolve(res);
}
// If invalid data uri
if (url.toString().startsWith('data:')) {
const request = new Request(url, options_);
return fetch.Promise.reject(new FetchError(`[${request.method}] ${request.url} invalid URL`, 'system'));
}
Body.Promise = fetch.Promise;
2015-01-26 09:46:32 -08:00
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// Wrap http.request into fetch
return new fetch.Promise((resolve, reject) => {
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// Build request object
const request = new Request(url, options_);
2016-11-23 13:39:35 -08:00
const options = getNodeRequestOptions(request);
2015-01-26 02:15:07 -08:00
const send = (options.protocol === 'https:' ? https : http).request;
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
const {signal} = request;
let response = null;
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
const abort = () => {
const error = new AbortError('The operation was aborted.');
reject(error);
if (request.body && request.body instanceof Stream.Readable) {
request.body.destroy(error);
}
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
if (!response || !response.body) {
return;
}
response.body.emit('error', error);
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
};
if (signal && signal.aborted) {
abort();
return;
}
const abortAndFinalize = () => {
abort();
finalize();
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
};
2015-01-26 02:15:07 -08:00
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// Send request
const request_ = send(options);
2015-01-27 05:11:26 -08:00
if (signal) {
signal.addEventListener('abort', abortAndFinalize);
}
function finalize() {
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
request_.abort();
if (signal) {
signal.removeEventListener('abort', abortAndFinalize);
}
}
2016-11-23 13:39:35 -08:00
if (request.timeout) {
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
request_.setTimeout(request.timeout, () => {
finalize();
reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout'));
2015-02-01 04:36:17 -08:00
});
}
2015-01-26 02:15:07 -08:00
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
request_.on('error', err => {
2016-11-23 13:39:35 -08:00
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
finalize();
2015-01-26 05:28:23 -08:00
});
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
request_.on('response', res => {
request_.setTimeout(0);
const headers = createHeadersLenient(res.headers);
2015-01-26 09:46:32 -08:00
// HTTP fetch step 5
if (fetch.isRedirect(res.statusCode)) {
// HTTP fetch step 5.2
const location = headers.get('Location');
// HTTP fetch step 5.3
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
const locationURL = location === null ? null : new URL(location, request.url);
// HTTP fetch step 5.5
switch (request.redirect) {
case 'error':
reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));
finalize();
return;
case 'manual':
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// Node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL.
if (locationURL !== null) {
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// Handle corrupted header
try {
headers.set('Location', locationURL);
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
} catch (error) {
// istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
reject(error);
}
}
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
break;
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
case 'follow': {
// HTTP-redirect fetch step 2
if (locationURL === null) {
break;
}
// HTTP-redirect fetch step 5
if (request.counter >= request.follow) {
reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));
finalize();
return;
}
// HTTP-redirect fetch step 6 (counter increment)
// Create a new Request object.
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
const requestOptions = {
headers: new Headers(request.headers),
follow: request.follow,
counter: request.counter + 1,
agent: request.agent,
compress: request.compress,
method: request.method,
body: request.body,
signal: request.signal,
timeout: request.timeout
};
// HTTP-redirect fetch step 9
if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
finalize();
return;
}
// HTTP-redirect fetch step 11
if (res.statusCode === 303 || ((res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST')) {
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
requestOptions.method = 'GET';
requestOptions.body = undefined;
requestOptions.headers.delete('content-length');
}
// HTTP-redirect fetch step 15
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
resolve(fetch(new Request(locationURL, requestOptions)));
finalize();
return;
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
}
default:
// Do nothing
}
2016-04-05 11:47:23 -07:00
}
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// Prepare response
res.once('end', () => {
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
if (signal) {
signal.removeEventListener('abort', abortAndFinalize);
}
});
let body = pump(res, new PassThrough(), error => {
reject(error);
});
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
const responseOptions = {
2018-03-04 20:29:12 -08:00
url: request.url,
status: res.statusCode,
statusText: res.statusMessage,
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
headers,
2018-03-04 20:29:12 -08:00
size: request.size,
timeout: request.timeout,
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
counter: request.counter,
highWaterMark: request.highWaterMark
};
2018-03-04 19:38:57 -08:00
// HTTP-network fetch step 12.1.1.3
2017-02-26 21:27:27 -08:00
const codings = headers.get('Content-Encoding');
2018-03-04 19:38:57 -08:00
// HTTP-network fetch step 12.1.1.4: handle content codings
// in following scenarios we ignore compression support
// 1. compression support is disabled
// 2. HEAD request
2017-02-26 21:27:27 -08:00
// 3. no Content-Encoding header
// 4. no content response (204)
// 5. content not modified response (304)
2017-02-26 21:27:27 -08:00
if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) {
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
response = new Response(body, responseOptions);
resolve(response);
return;
}
// For Node v6+
// Be less strict when decoding compressed responses, since sometimes
// servers send slightly invalid responses that are still accepted
// by common browsers.
// Always using Z_SYNC_FLUSH is what cURL does.
const zlibOptions = {
flush: zlib.Z_SYNC_FLUSH,
finishFlush: zlib.Z_SYNC_FLUSH
};
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// For gzip
if (codings === 'gzip' || codings === 'x-gzip') {
body = pump(body, zlib.createGunzip(zlibOptions), error => {
reject(error);
});
response = new Response(body, responseOptions);
resolve(response);
return;
2017-02-26 21:27:27 -08:00
}
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// For deflate
if (codings === 'deflate' || codings === 'x-deflate') {
// Handle the infamous raw deflate response from old servers
// a hack for old IIS and Apache servers
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
const raw = pump(res, new PassThrough(), error => {
reject(error);
});
raw.once('data', chunk => {
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// See http://stackoverflow.com/questions/37519828
if ((chunk[0] & 0x0F) === 0x08) {
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
body = pump(body, zlib.createInflate(), error => {
reject(error);
});
} else {
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
body = pump(body, zlib.createInflateRaw(), error => {
reject(error);
});
}
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
response = new Response(body, responseOptions);
resolve(response);
});
return;
}
2015-01-26 02:15:07 -08:00
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// For br
if (codings === 'br') {
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
body = pump(body, zlib.createBrotliDecompress(), error => {
reject(error);
});
response = new Response(body, responseOptions);
resolve(response);
return;
}
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// Otherwise, use response as-is
response = new Response(body, responseOptions);
resolve(response);
2015-01-26 02:15:07 -08:00
});
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
writeToStream(request_, request);
2015-01-26 02:15:07 -08:00
});
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
}
2015-01-26 01:02:34 -08:00
2015-01-26 09:46:32 -08:00
/**
2015-01-27 05:11:26 -08:00
* Redirect code matching
2015-01-26 09:46:32 -08:00
*
* @param Number code Status code
* @return Boolean
*/
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
fetch.isRedirect = code => [301, 302, 303, 307, 308].includes(code);
2015-01-26 09:46:32 -08:00
merge 3.x into master branch (#745) * feat: Migrate TypeScript types (#669) * style: Introduce linting via XO * fix: Fix tests * chore!: Drop support for nodejs 4 and 6 * chore: Fix Travis CI yml * Use old Babel (needs migration) * chore: lint everything * chore: Migrate to microbundle * Default response.statusText should be blank (#578) * fix: Use correct AbortionError message Signed-off-by: Richie Bendall <[email protected]> * chore: Use modern @babel/register Signed-off-by: Richie Bendall <[email protected]> * chore: Remove redundant packages Signed-off-by: Richie Bendall <[email protected]> * chore: Readd form-data Signed-off-by: Richie Bendall <[email protected]> * fix: Fix tests and force utf8-encoded urls Signed-off-by: Richie Bendall <[email protected]> * lint index.js * Update devDependencies & ignore `test` directory in linter options * Remove unnecessary eslint-ignore comment * Update the `lint` script to run linter on every file * Remove unused const & unnecessary import * TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721) * chore: Lint as part of the build process * fix: Convert Content-Encoding to lowercase (#672) * fix: Better object checks (#673) * Fix stream piping (#670) * chore: Remove useless check Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint Signed-off-by: Richie Bendall <[email protected]> * refactor: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Ensure all files are properly included Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps and utf8 should be in dependencies Signed-off-by: Richie Bendall <[email protected]> * test: Drop Node v4 from tests Signed-off-by: Richie Bendall <[email protected]> * test: Modernise code Signed-off-by: Richie Bendall <[email protected]> * chore: Move errors to seperate directory Signed-off-by: Richie Bendall <[email protected]> * refactor: Add fetch-blob (#678) * feat: Migrate data uri integration Signed-off-by: Richie Bendall <[email protected]> * Allow setting custom highWaterMark via node-fetch options (#386) (#671) * Expose highWaterMark option to body clone function * Add highWaterMark to responseOptions * Add highWaterMark as node-fetch-only option * a way to silently pass highWaterMark to clone * Chai helper * Server helper * Tests * Remove debug comments * Document highWaterMark option * Add TypeScript types for the new highWaterMark option * feat: Include system error in FetchError if one occurs (#654) * style: Add editorconfig Signed-off-by: Richie Bendall <[email protected]> * chore!: Drop NodeJS v8 Signed-off-by: Richie Bendall <[email protected]> * chore: Remove legacy code for node < 8 Signed-off-by: Richie Bendall <[email protected]> * chore: Use proper checks for ArrayBuffer and AbortError Signed-off-by: Richie Bendall <[email protected]> * chore: Use explicitly set error name in checks Signed-off-by: Richie Bendall <[email protected]> * Propagate size and timeout to cloned response (#664) * Remove --save option as it isn't required anymore (#581) * Propagate size and timeout to cloned response Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> * Update Response types * Update devDependencies * feat: Fallback to blob type (Closes: #607) Signed-off-by: Richie Bendall <[email protected]> * style: Update formatting Signed-off-by: Richie Bendall <[email protected]> * style: Fix linting issues Signed-off-by: Richie Bendall <[email protected]> * docs: Add info on patching the global object * docs: Added non-globalThis polyfill * Replace deprecated `url.resolve` with the new WHATWG URL * Update devDependencies * Format code in examples to use `xo` style * Verify examples with RunKit and edit them if necessary * Add information about TypeScript support * Document the new `highWaterMark` option * Add Discord badge & information about Open Collective * Style change * Edit acknowledgement & add "Team" section * fix table * Format example code to use xo style * chore: v3 release changelog * Add the recommended way to fix `highWaterMark` issues * docs: Add simple Runkit example * fix: Properly set the name of the errors. Signed-off-by: Richie Bendall <[email protected]> * docs: Add AbortError to documented types Signed-off-by: Richie Bendall <[email protected]> * docs: AbortError proper typing parameters Signed-off-by: Richie Bendall <[email protected]> * docs: Add example code for Runkit Signed-off-by: Richie Bendall <[email protected]> * Replace microbundle with @pika/pack (#689) * gitignore the pkg/ directory * Move TypeScript types to the root of the project * Replace microbundle with @pika/pack * chore: Remove @pika/plugin-build-web and revert ./dist output directory Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]> * fix incorrect statement in changelog * chore: v3.x upgrade guide * Change the Open Collective button * docs: Encode support button as Markdown instead of HTML * chore: Ignore proper directory in xo * Add an "Upgrading" section to readme * Split the upgrade guide into 2 files & add the missing changes about v3.x * style: Lint test and example files Signed-off-by: Richie Bendall <[email protected]> * Move *.md files to the `docs` folder (except README.md) * Update references to files * Split LIMITS.md into 2 files (as of v2.x and v3.x) * chore: Remove logging statement Signed-off-by: Richie Bendall <[email protected]> * style: Fix lint * docs: Correct typings for systemError in FetchError (Fixes #697) * refactor: Replace `encoding` with `fetch-charset-detection`. (#694) * refactor: Replace `encoding` with `fetch-charset-detection`. Signed-off-by: Richie Bendall <[email protected]> * refactor: Move writing to stream back to body.js Signed-off-by: Richie Bendall <[email protected]> * refactor: Only put convertBody in fetch-charset-detection and refactor others. Signed-off-by: Richie Bendall <[email protected]> * test: Readd tests for getTotalBytes and extractContentType Signed-off-by: Richie Bendall <[email protected]> * chore: Revert package.json indention Signed-off-by: Richie Bendall <[email protected]> * chore: Remove optional dependency * docs: Replace code for fetch-charset-detection with documentation. Signed-off-by: Richie Bendall <[email protected]> * chore: Remove iconv-lite * fix: Use default export instead of named export for convertBody Signed-off-by: Richie Bendall <[email protected]> * chore: Remove unneeded installation of fetch-charset-detection in the build * docs: Fix typo * fix: Throw SyntaxError instead of FetchError in case of invalid… (#700) * fix: Throw SyntaxError instead of FetchError in case of invalid JSON Signed-off-by: Richie Bendall <[email protected]> * docs: Add to upgrade guide Signed-off-by: Richie Bendall <[email protected]> * Remove deprecated url.parse from test * Remove deprecated url.parse from server * fix: Proper data uri to buffer conversion (#703) Signed-off-by: Richie Bendall <[email protected]> * chore: Add funding info * fix: Flawed property existence test (#706) Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination. * fix: Properly handle stream pipeline double-fire Signed-off-by: Richie Bendall <[email protected]> * docs: Fix spelling Signed-off-by: Richie Bendall <[email protected]> * chore: Add `funding` field to package.json (#708) * Fix: Do not set ContentLength to NaN (#709) * do not set ContentLength to NaN * lint * docs: Add logo Signed-off-by: Richie Bendall <[email protected]> * chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch. Signed-off-by: Richie Bendall <[email protected]> * chore: Fix unit tests Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713) Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump nyc from 14.1.1 to 15.0.0 (#714) Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0. - [Release notes](https://github.com/istanbuljs/nyc/releases) - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md) - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: Update travis ci url Signed-off-by: Richie Bendall <[email protected]> * chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711) Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * feat: Allow excluding a user agent in a fetch request by setting… (#715) Signed-off-by: Richie Bendall <[email protected]> * Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717) Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump form-data from 2.5.1 to 3.0.0 (#712) Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0. - [Release notes](https://github.com/form-data/form-data/releases) - [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0) Signed-off-by: dependabot-preview[bot] <[email protected]> * fix: typo * update suggestion * feat: Added missing redirect function (#718) * added missing redirect function * chore: Add types Co-authored-by: Richie Bendall <[email protected]> * fix: Use req.setTimeout for timeout (#719) * chore: Update typings comment Signed-off-by: Richie Bendall <[email protected]> * chore: Update deps Signed-off-by: Richie Bendall <[email protected]> * docs: center badges & Open Collective button * docs: add missing comma * Remove current stable & LTS node version numbers from the comments I don't think we really want to update them * Bump xo from 0.25.4 to 0.26.1 (#730) Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1. - [Release notes](https://github.com/xojs/xo/releases) - [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729) Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726) Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2. - [Release notes](https://github.com/pikapkg/builders/releases) - [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2) Signed-off-by: dependabot-preview[bot] <[email protected]> * docs: Update information about `req.body` type in v3.x release * Add information about removed body type to the v3 upgrade guide * add awesome badge * Show 2 ways of importing node-fetch (CommonJS & ES module) * update dependencies * lint * refactor: Replace `url.parse` with `new URL()` (#701) * chore: replace `url.parse` with `new URL()` * lint * handle relative URLs * Change error message * detect whether the url is absolute or not * update tests * drop relative url support * lint * fix tests * typo * Add information about dropped arbitrary URL support in v3.x upgrade guide * set xo linting rule (node/no-deprecated-api) to on * remove the `utf8` dependency * fix * refactor: split tests into several files, create the `utils` directory * Update package.json scripts & remove unnecessary xo linting rules * refactor: turn on some xo linting rules to improve code quality * fix tests * Remove invalid urls * fix merge conflict * update the upgrade guide * test if URLs are encoded as UTF-8 * update xo to 0.28.0 * chore: Build before publishing * v3.0.0-beta.1 * fix lint on test/main.js Co-authored-by: Richie Bendall <[email protected]> Co-authored-by: Antoni Kepinski <[email protected]> Co-authored-by: aeb-sia <50743092+[email protected]> Co-authored-by: Nazar Mokrynskyi <[email protected]> Co-authored-by: Steve Moser <[email protected]> Co-authored-by: Erick Calder <[email protected]> Co-authored-by: Yaacov Rydzinski <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Jimmy Wärting <[email protected]>
2020-03-13 08:06:25 -07:00
// Expose Promise
fetch.Promise = global.Promise;