-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No error is emitted on response destroy when socket is already destroyed #35923
Labels
http
Issues or PRs related to the http subsystem.
Comments
szmarczak
changed the title
No error is emitted on response when socket is destroyed
No error is emitted on response destroy when socket is already destroyed
Nov 2, 2020
Same behaviour in v16.1.0. Possibly @jasnell should keep in mind the issue when implementing HTTP3? |
This was referenced Jul 22, 2021
1 task
renovate bot
referenced
this issue
in valora-inc/hooks
Mar 22, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [got](https://togithub.com/sindresorhus/got) | [`^11.8.6` -> `^12.6.0`](https://renovatebot.com/diffs/npm/got/11.8.6/12.6.0) | [![age](https://badges.renovateapi.com/packages/npm/got/12.6.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/got/12.6.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/got/12.6.0/compatibility-slim/11.8.6)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/got/12.6.0/confidence-slim/11.8.6)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>sindresorhus/got</summary> ### [`v12.6.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.6.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.3...v12.6.0) - Update dependencies [`88c88fb`](https://togithub.com/sindresorhus/got/commit/88c88fb) [`979272e`](https://togithub.com/sindresorhus/got/commit/979272e) - Loosen URL validation strictness ([#​2200](https://togithub.com/sindresorhus/got/issues/2200)) [`0ca0b7f`](https://togithub.com/sindresorhus/got/commit/0ca0b7f) ### [`v12.5.3`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.3) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.2...v12.5.3) - Fix abort event listeners not always being cleaned up ([#​2162](https://togithub.com/sindresorhus/got/issues/2162)) [`3cc40b5`](https://togithub.com/sindresorhus/got/commit/3cc40b5) ### [`v12.5.2`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.1...v12.5.2) - Improve TypeScript 4.9 compatibility ([#​2163](https://togithub.com/sindresorhus/got/issues/2163)) [`39f83b6`](https://togithub.com/sindresorhus/got/commit/39f83b6) ### [`v12.5.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.0...v12.5.1) - Fix compatibility with TypeScript and ESM [`3b3ea67`](https://togithub.com/sindresorhus/got/commit/3b3ea67) - Fix request body not being properly cached ([#​2150](https://togithub.com/sindresorhus/got/issues/2150)) [`3e9d3af`](https://togithub.com/sindresorhus/got/commit/3e9d3af) ### [`v12.5.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.4.1...v12.5.0) - Disable method rewriting on 307 and 308 status codes ([#​2145](https://togithub.com/sindresorhus/got/issues/2145)) [`e049e94`](https://togithub.com/sindresorhus/got/commit/e049e94) - Upgrade dependencies [`8630815`](https://togithub.com/sindresorhus/got/commit/8630815) [`f0ac0b3`](https://togithub.com/sindresorhus/got/commit/f0ac0b3) [`4c3762a`](https://togithub.com/sindresorhus/got/commit/4c3762a) ### [`v12.4.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.4.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.4.0...v12.4.1) ##### Fixes - Fix `options.context` being not extensible [`b671480`](https://togithub.com/sindresorhus/got/commit/b671480715dbbff908e9a385f5e714570c663cd7) - Don't emit `uploadProgress` after promise cancelation [`693de21`](https://togithub.com/sindresorhus/got/commit/693de217b030816f574d6e4cb505ee2e77b21c29) ### [`v12.4.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.4.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.3.1...v12.4.0) ##### Improvements - Support FormData without known length ([#​2120](https://togithub.com/sindresorhus/got/issues/2120)) [`850773c`](https://togithub.com/sindresorhus/got/commit/850773c) ##### Fixes - Don't call `beforeError` hooks with `HTTPError` if the `throwHttpErrors` option is `false` ([#​2104](https://togithub.com/sindresorhus/got/issues/2104)) [`3927348`](https://togithub.com/sindresorhus/got/commit/3927348) ### [`v12.3.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.3.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.3.0...v12.3.1) - Don't freeze signal when freezing Options ([#​2100](https://togithub.com/sindresorhus/got/issues/2100)) [`43b1467`](https://togithub.com/sindresorhus/got/commit/43b1467) ### [`v12.3.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.3.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.2.0...v12.3.0) - Add `.off()` method for events ([#​2092](https://togithub.com/sindresorhus/got/issues/2092)) [`88056be`](https://togithub.com/sindresorhus/got/commit/88056be) ### [`v12.2.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.2.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.1.0...v12.2.0) - [Support `AbortController`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#signal) ([#​2020](https://togithub.com/sindresorhus/got/issues/2020)) [`6a6d2a9`](https://togithub.com/sindresorhus/got/commit/6a6d2a9) - Add [`enableUnixSockets`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#enableunixsockets) option ([#​2062](https://togithub.com/sindresorhus/got/issues/2062)) [`461b3d4`](https://togithub.com/sindresorhus/got/commit/461b3d4) ### [`v12.1.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.1.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.4...v12.1.0) ##### Improvements - Add `response.ok` ([#​2043](https://togithub.com/sindresorhus/got/issues/2043)) [`22d58fb`](https://togithub.com/sindresorhus/got/commit/22d58fb) - This is only useful if you have [`{throwHttpErrors: false}`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#throwhttperrors) ##### Fixes - Do not redirect to UNIX sockets ([#​2047](https://togithub.com/sindresorhus/got/issues/2047)) [`861ccd9`](https://togithub.com/sindresorhus/got/commit/861ccd9) - [CVE-2022-33987](https://nvd.nist.gov/vuln/detail/CVE-2022-33987) - [Also back ported to v11](https://togithub.com/sindresorhus/got/releases/tag/v11.8.5) ### [`v12.0.4`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.4) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.3...v12.0.4) - Remove stream lock - unreliable since Node 17.3.0 [`bb8eca9`](https://togithub.com/sindresorhus/got/commit/bb8eca924c338ca12d5b90d6a26aa28dbddb42ee) ### [`v12.0.3`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.3) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.2...v12.0.3) - Allow more types in the `json` option ([#​2015](https://togithub.com/sindresorhus/got/issues/2015)) [`eb045bf`](https://togithub.com/sindresorhus/got/commit/eb045bf) ### [`v12.0.2`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.1...v12.0.2) - Fix `encoding` option with `{responseType: 'json'}` ([#​1996](https://togithub.com/sindresorhus/got/issues/1996)) [`0703318`](https://togithub.com/sindresorhus/got/commit/0703318) ### [`v12.0.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.0...v12.0.1) - Fix `nock` compatibility ([#​1959](https://togithub.com/sindresorhus/got/issues/1959)) [`bf39d2c`](https://togithub.com/sindresorhus/got/commit/bf39d2c) - Fix missing export of `Request` TypeScript type ([#​1940](https://togithub.com/sindresorhus/got/issues/1940)) [`0f9f2b8`](https://togithub.com/sindresorhus/got/commit/0f9f2b8) ### [`v12.0.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.8.6...v12.0.0) ##### Introducing Got v12.0.0 🎉 Long time no see! The latest Got version (v11.8.2) was released just in February ❄️ We have been working hard on squashing bugs and improving overall experience. If you find Got useful, you might want to [sponsor the Got maintainers](https://togithub.com/sindresorhus/got?sponsor=1). ##### This package is now pure ESM **Please [read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).** Also see [https://github.com/sindresorhus/got/issues/1789](https://togithub.com/sindresorhus/got/issues/1789). - **Please don't open issues about `[ERR_REQUIRE_ESM]` and `Must use import to load ES Module` errors.** This is a problem with your setup, not Got. - Please don't open issues about using Got with Jest. Jest does not fully support ESM. - Pretty much any problem with loading this package is a problem with your bundler, test framework, etc, not Got. - If you use TypeScript, you will want to stay on Got v11 until TypeScript 4.6 is out. [Why.](https://togithub.com/microsoft/TypeScript/issues/46452) - If you use a bundler, make sure it supports ESM and that you have correctly configured it for ESM. - The Got issue tracker is not a support channel for your favorite build/bundler tool. ##### Required Node.js >=14 While working with streams, we encountered more Node.js bugs that needed workarounds. In order to keep our code clean, we had to drop Node.js v12 as the code would get more messy. We strongly recommend that you update Node.js to **v14 LTS**. ##### HTTP/2 support Every Node.js release, the native `http2` module gets more stable. Unfortunately there are still some issues on the Node.js side, so we decided to keep HTTP/2 disabled for now. We may enable it by default in Got v13. It is still possible to turn it on via the `http2` option. To run HTTP/2 requests, it is required to use Node.js **v15.10** or above. ##### Bug fixes Woah, we possibly couldn't make a release if we didn't fix some bugs! - Do not throw on custom stack traces ([#​1491](https://togithub.com/sindresorhus/got/issues/1491)) [`49c16ee`](https://togithub.com/sindresorhus/got/commit/49c16ee54fb19ea7aa77e24ac8c2b602f0aad265) - Remove automatic `content-length` on ReadStream ([#​1510](https://togithub.com/sindresorhus/got/issues/1510)) [`472b8ef`](https://togithub.com/sindresorhus/got/commit/472b8ef9d9fc7713b740981a8b1103a7a9111b26) - Fix promise shortcuts in case of error status code ([#​1543](https://togithub.com/sindresorhus/got/issues/1543)) [`ff918fb`](https://togithub.com/sindresorhus/got/commit/ff918fb6dedb6d8b23421497ec890d43f45121b7) [`1107cc6`](https://togithub.com/sindresorhus/got/commit/1107cc625e4cc469276483316c48896a21f6251a) - Invert the `methodRewriting` option [`51d88a0`](https://togithub.com/sindresorhus/got/commit/51d88a0efed56760d116c5b911cea71e3265c787) - Fix `url` not being reused on retry in rare case ([#​1487](https://togithub.com/sindresorhus/got/issues/1487)) [`462bc63`](https://togithub.com/sindresorhus/got/commit/462bc630015064fa4ad4358cf28d24f95e1c958b) - Fix hanging promise on HTTP/2 timeout ([#​1492](https://togithub.com/sindresorhus/got/issues/1492)) [`a59fac4`](https://togithub.com/sindresorhus/got/commit/a59fac415ac013a48b1d514837628a5cf81d6878) - Prevent uncaught ParseErrors on initial successful response ([#​1527](https://togithub.com/sindresorhus/got/issues/1527)) [`77df9c3`](https://togithub.com/sindresorhus/got/commit/77df9c33db5ba3126f54317171e1cfcfceefc3d5) - Throw an error when retrying with consumed body ([#​1507](https://togithub.com/sindresorhus/got/issues/1507)) [`62305d7`](https://togithub.com/sindresorhus/got/commit/62305d77d3428b5c714d21b4bbee68cc75b5f787) - Fix a Node.js 16 bug that hangs Got streams [`06a2d3d`](https://togithub.com/sindresorhus/got/commit/06a2d3d7d8d4fcc6898b6364d1a18ca1d407092b) - Fix default pagination handling for empty Link header ([#​1768](https://togithub.com/sindresorhus/got/issues/1768)) [`1e1e506`](https://togithub.com/sindresorhus/got/commit/1e1e50647e93d038a4cc6a9bbbfbf61165d8fd39) - Fix incorrect `response.complete` when using cache [`9e15d88`](https://togithub.com/sindresorhus/got/commit/9e15d887da3b065940bbc8ca38f9c748a0bbc75e) - Fix `Cannot call end` error when `request` returns a `Writable` [`226cc39`](https://togithub.com/sindresorhus/got/commit/226cc3995f6e16938163ebde24d8762e7dcd15e2) - Fix Request options not being reused on retry [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Fix types being not compatible with CommonJS [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Fix `got.paginate does not call init hooks` ([#​1574](https://togithub.com/sindresorhus/got/issues/1574)) [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Generate a new object when passing options to the native `https` module ([#​1567](https://togithub.com/sindresorhus/got/issues/1567)) [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Remove stream reuse check ([#​1803](https://togithub.com/sindresorhus/got/issues/1803)) [`9ecc5ee`](https://togithub.com/sindresorhus/got/commit/9ecc5ee76f77aafd5100520d9d8789c491c8fb24) - Fix merging `searchParams` ([#​1814](https://togithub.com/sindresorhus/got/issues/1814)) [`1018c20`](https://togithub.com/sindresorhus/got/commit/1018c2029eea1f5b75b5120265996f1c0b3c12ae) [`732e9bd`](https://togithub.com/sindresorhus/got/commit/732e9bd9406ba1c3dd64b445264e891f33fc0254) - Fix unhandled exception when lookup returns invalid IP early ([#​1737](https://togithub.com/sindresorhus/got/issues/1737)) [`2453e5e`](https://togithub.com/sindresorhus/got/commit/2453e5e4213fe036a0108de3e4db414dcf2b4c30) - Fix relative URLs when paginating [`439fb82`](https://togithub.com/sindresorhus/got/commit/439fb82d2a07cece417a18c47e37cfdeaaf38db7) - Require url to be an instance of URL when paginating ([#​1818](https://togithub.com/sindresorhus/got/issues/1818)) [`eda69ff`](https://togithub.com/sindresorhus/got/commit/eda69ff924a621e499d31cbc590993a32ddb48d3) - Fix `username` and `password` encoding in URL ([#​1169](https://togithub.com/sindresorhus/got/issues/1169) [#​1317](https://togithub.com/sindresorhus/got/issues/1317)) [`d65d0ca`](https://togithub.com/sindresorhus/got/commit/d65d0caf627e8d1f5367db34d7d9b55d332c1efb) - Clone raw options [`1c4cefc`](https://togithub.com/sindresorhus/got/commit/1c4cefc9b49f891712c3758f853d8c6214a1c904) - Fix invalid `afterResponse` return check [`cbc8902`](https://togithub.com/sindresorhus/got/commit/cbc8902) - Fix `https.alpnProtocols` not having an effect [`e1099fb`](https://togithub.com/sindresorhus/got/commit/e1099fb) ##### Improvements - Make the `context` option mergeable ([#​1459](https://togithub.com/sindresorhus/got/issues/1459)) [`2b8ed1f`](https://togithub.com/sindresorhus/got/commit/2b8ed1f5a185f30603d24e2ceb8181782de3bc5a) - Add generic argument to AfterResponseHook TypeScript type ([#​1589](https://togithub.com/sindresorhus/got/issues/1589)) [`6fc04a9`](https://togithub.com/sindresorhus/got/commit/6fc04a9b92f07b07b9fba010f2231a90082a039b) - Add read timeout ([#​1518](https://togithub.com/sindresorhus/got/issues/1518)) [`e943672`](https://togithub.com/sindresorhus/got/commit/e9436720fcb32b77d39d5477b420b18083e41c02) *(blocked by [https://github.com/nodejs/node/issues/35923](https://togithub.com/nodejs/node/issues/35923))* - Improve the pagination API ([#​1644](https://togithub.com/sindresorhus/got/issues/1644)) [`2675046`](https://togithub.com/sindresorhus/got/commit/2675046a83c7f03613f553a8da2912d491be900d) - Change the stackAllItems option to be false by default ([#​1645](https://togithub.com/sindresorhus/got/issues/1645)) [`1120370`](https://togithub.com/sindresorhus/got/commit/1120370e05fd8d9e768677d8474d0c82cf91a6a6) - Throw when afterResponse hook returns an invalid value [`4f21eb3`](https://togithub.com/sindresorhus/got/commit/4f21eb3db705c90797ef8ee1503704f78fea3c1b) - Add `retry.backoffLimit` option [`41c4136`](https://togithub.com/sindresorhus/got/commit/41c4136632b9391adb3ac53332b312089bc4dc16) - Add `noise` retry option [`e830077`](https://togithub.com/sindresorhus/got/commit/e83007704670b5f567ca338c156441f6c569ecb5) - Enable more HTTPS options [`83575d5`](https://togithub.com/sindresorhus/got/commit/83575d590a119027d319bd9208681973087564a9) [`fe723a0`](https://togithub.com/sindresorhus/got/commit/fe723a0477dc02785a0b477e3d5f85d0233e5b84) (thanks [@​Giotino](https://togithub.com/Giotino)) - Define `error.code` [`f27e8d3`](https://togithub.com/sindresorhus/got/commit/f27e8d331627074e76e4a9ec85a2c8d0a0625e5f) - Set `options.url` even if some options are invalid [`8d6a680`](https://togithub.com/sindresorhus/got/commit/8d6a6807883323a83ea5f126ca56b55d9ce5f299) - Improve memory usage when merging options [`2db5ec5`](https://togithub.com/sindresorhus/got/commit/2db5ec5d366efbbf9e0838eabfa6be774a0518a0) - Support async generators as body [`854430f`](https://togithub.com/sindresorhus/got/commit/854430f01350811fe8a0ccf20cd820aabfbd3926) [`3df52f3`](https://togithub.com/sindresorhus/got/commit/3df52f38edbadb45158c37d499817bc5486989c6) - Add missing `once` types for Stream API [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - New error type: `RetryError` which always triggers a new retry when thrown [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - `error.options` is now enumerable [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - `defaults.handlers` don't need a default handler now [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Add a parser for the `Link` header [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - General code improvements [`a5dd9aa`](https://togithub.com/sindresorhus/got/commit/a5dd9aa37e7891b2620798560799c7f8bd380877) ##### Breaking changes ##### Improved option normalization - Got exports an `Option` class that is specifically designed to parse and validate Got options. It is made of setters and getters that provide fast normalization and more consistent behavior. When passing an option does not exist, Got will throw an error. In order to retrieve the options before the error, use `error.options`. ```js import got from 'got'; try { await got('https://httpbin.org/anything', { thisOptionDoesNotExist: true }); } catch (error) { console.error(error); console.error(error.options.url.href); // Unexpected option: thisOptionDoesNotExist // https://httpbin.org/anything } ``` - The `init` hook now accepts a second argument: `self`, which points to an `Options` instance. In order to define your own options, you have to move them to `options.context` in an [`init` hook](https://togithub.com/sindresorhus/got/blob/main/documentation/lets-make-a-plugin.md#authorization) or store them in `options.context` directly. - The `init` hooks are ran only when passing an options object explicitly. ```diff - await got('https://example.com'); // this will *not* trigger the init hooks + await got('https://example.com', {}); // this *will** trigger init hooks ``` - [`options.merge()`](2-options.md) replaced `got.mergeOptions` and `Request.normalizeArguments` ```diff - got.defaults.options = got.mergeOptions(got.defaults.options, {…}); + got.defaults.options.merge(…); ``` This fixes issues like [#​1450](https://togithub.com/sindresorhus/got/issues/1450) - Legacy `Url` instances are not supported anymore. You need to use WHATWG URL instead. ```diff - await got(string, {port: 8443}); + const url = new URL(string); + url.port = 8443; + await got(url); ``` - No implicit timeout declaration. ```diff - await got('https://example.com', {timeout: 5000}) + await got('https://example.com', {timeout: {request: 5000}) ``` - No implicit retry declaration. ```diff - await got('https://example.com', {retry: 5}) + await got('https://example.com', {retry: {limit: 5}) ``` - `dnsLookupIpVersion` is now a number (4 or 6) or undefined ```diff - await got('https://example.com', {dnsLookupIpVersion: 'ipv4'}) + await got('https://example.com', {dnsLookupIpVersion: 4}) ``` - `redirectUrls` and `requestUrl` now give URL instances ```diff - request.requestUrl + request.requestUrl.origin + request.requestUrl.href + request.requestUrl.toString() ``` ```diff - request.redirectUrls[0] + request.redirectUrls[0].origin + request.redirectUrls[0].href + request.redirectUrls[0].toString() ``` - Renamed `request.aborted` to `request.isAborted` ```diff - request.aborted + request.isAborted ``` Reason: consistency with `options.isStream`. - Renamed the `lookup` option to `dnsLookup` ```diff - await got('https://example.com', {lookup: cacheable.lookup}) + await got('https://example.com', {dnsLookup: cacheable.lookup}) ``` - The `beforeRetry` hook now accepts only two arguments: `error` and `retryCount` ```diff await got('https://example.com', { hooks: { beforeRetry: [ - (options, error, retryCount) => { - console.log(options, error, retryCount); - } + (error, retryCount) => { + console.log(error.options, error, retryCount); + } ] } }) ``` The `options` argument has been removed, however it's still accessible via `error.options`. All modifications on `error.options` will be reflected in the next requests (no behavior change, same as with Got 11). - The `beforeRedirect` hook's first argument (options) is now a cloned instance of the Request options. This was done to make retrieving the original options possible: `plainResponse.request.options`. ```diff await got('http://szmarczak.com', { hooks: { beforeRedirect: [ (options, response) => { - console.log(options === response.request.options); //=> true [invalid! our original options were overriden] + console.log(options === response.request.options); //=> false [we can access the original options now] } ] } }) ``` - The `redirect` event now takes two arguments in this order: `updatedOptions` and `plainResponse`. ```diff - stream.on('redirect', (response, options) => …) + stream.on('redirect', (options, response) => …) ``` Reason: consistency with the `beforeRedirect` hook. - The `socketPath` option has been removed. Use the `unix:` protocol instead. ```diff - got('/containers/json', {socketPath: '/var/run/docker.sock'}) + got('unix:/var/run/docker.sock:/containers/json') + got('http://unix:/var/run/docker.sock:/containers/json') ``` - The `retryWithMergedOptions` function in an `afterResponse` hook no longer returns a `Promise`. It now throws `RetryError`, so this should this should be the last function being executed. This was done to allow `beforeRetry` hooks getting called. - You can no longer set `options.agent` to `false`. To do so, you need to define all the `options.agent` properties: `http`, `https` and `http2`. ```diff await got('https://example.com', { - agent: false + agent: { + http: false, + https: false, + http2: false + } }) ``` - When passing a `url` option when paginating, it now needs to be an absolute URL - the `prefixUrl` option is always reset from now on. The same when retrying in an `afterResponse` hook. ```diff - return {url: '/location'}; + return {url: new URL('/location', response.request.options.url)}; ``` There was confusion around the `prefixUrl` option. It was counterintuitive if used with the Pagination API. For example, it worked fine if the server replied with a relative URL, but if it was an absolute URL then the `prefixUrl` would end up duplicated. In order to fix this, Got now requires an absolute URL - no `prefixUrl` will be applied. - `got.extend(…)` will throw when passing some options that don't accept undefined - undefined no longer retains the old value, as setting undefined explicitly may reset the option ##### Documentation We have redesigned the documentation so it's easier to navigate and find exactly what you are looking for. We hope you like it ❤️ </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - "after 8:00 before 23:00 every weekday except on Friday" in timezone UTC. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/valora-inc/plugin-poc). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNy4xIiwidXBkYXRlZEluVmVyIjoiMzUuMTcuMSJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
gastonfournier
referenced
this issue
in Unleash/unleash
Jul 5, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [got](https://togithub.com/sindresorhus/got) | [`^11.8.5` -> `^13.0.0`](https://renovatebot.com/diffs/npm/got/11.8.6/13.0.0) | [![age](https://badges.renovateapi.com/packages/npm/got/13.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/got/13.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/got/13.0.0/compatibility-slim/11.8.6)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/got/13.0.0/confidence-slim/11.8.6)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>sindresorhus/got</summary> ### [`v13.0.0`](https://togithub.com/sindresorhus/got/releases/tag/v13.0.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.6.1...v13.0.0) As a reminder, Got continues to require ESM. For TypeScript users, this includes having [`"module": "node16", "moduleResolution": "node16"` in your tsconfig](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-make-my-typescript-project-output-esm). ##### Breaking - Require Node.js 16 [`52a1063`](https://togithub.com/sindresorhus/got/commit/52a1063) - Change the [`enableUnixSockets`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#enableunixsockets) option to be `false` by default [`852c312`](https://togithub.com/sindresorhus/got/commit/852c312) - Most users don't need it. ##### Improvements - Allow specifying `undefined` for options ([#​2258](https://togithub.com/sindresorhus/got/issues/2258)) [`1cefe8b`](https://togithub.com/sindresorhus/got/commit/1cefe8b) ### [`v12.6.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.6.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.6.0...v12.6.1) - Fix `get-stream` import statement ([#​2266](https://togithub.com/sindresorhus/got/issues/2266)) [`67d5039`](https://togithub.com/sindresorhus/got/commit/67d5039) ### [`v12.6.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.6.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.3...v12.6.0) - Update dependencies [`88c88fb`](https://togithub.com/sindresorhus/got/commit/88c88fb) [`979272e`](https://togithub.com/sindresorhus/got/commit/979272e) - Loosen URL validation strictness ([#​2200](https://togithub.com/sindresorhus/got/issues/2200)) [`0ca0b7f`](https://togithub.com/sindresorhus/got/commit/0ca0b7f) ### [`v12.5.3`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.3) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.2...v12.5.3) - Fix abort event listeners not always being cleaned up ([#​2162](https://togithub.com/sindresorhus/got/issues/2162)) [`3cc40b5`](https://togithub.com/sindresorhus/got/commit/3cc40b5) ### [`v12.5.2`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.1...v12.5.2) - Improve TypeScript 4.9 compatibility ([#​2163](https://togithub.com/sindresorhus/got/issues/2163)) [`39f83b6`](https://togithub.com/sindresorhus/got/commit/39f83b6) ### [`v12.5.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.0...v12.5.1) - Fix compatibility with TypeScript and ESM [`3b3ea67`](https://togithub.com/sindresorhus/got/commit/3b3ea67) - Fix request body not being properly cached ([#​2150](https://togithub.com/sindresorhus/got/issues/2150)) [`3e9d3af`](https://togithub.com/sindresorhus/got/commit/3e9d3af) ### [`v12.5.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.4.1...v12.5.0) - Disable method rewriting on 307 and 308 status codes ([#​2145](https://togithub.com/sindresorhus/got/issues/2145)) [`e049e94`](https://togithub.com/sindresorhus/got/commit/e049e94) - Upgrade dependencies [`8630815`](https://togithub.com/sindresorhus/got/commit/8630815) [`f0ac0b3`](https://togithub.com/sindresorhus/got/commit/f0ac0b3) [`4c3762a`](https://togithub.com/sindresorhus/got/commit/4c3762a) ### [`v12.4.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.4.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.4.0...v12.4.1) ##### Fixes - Fix `options.context` being not extensible [`b671480`](https://togithub.com/sindresorhus/got/commit/b671480715dbbff908e9a385f5e714570c663cd7) - Don't emit `uploadProgress` after promise cancelation [`693de21`](https://togithub.com/sindresorhus/got/commit/693de217b030816f574d6e4cb505ee2e77b21c29) ### [`v12.4.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.4.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.3.1...v12.4.0) ##### Improvements - Support FormData without known length ([#​2120](https://togithub.com/sindresorhus/got/issues/2120)) [`850773c`](https://togithub.com/sindresorhus/got/commit/850773c) ##### Fixes - Don't call `beforeError` hooks with `HTTPError` if the `throwHttpErrors` option is `false` ([#​2104](https://togithub.com/sindresorhus/got/issues/2104)) [`3927348`](https://togithub.com/sindresorhus/got/commit/3927348) ### [`v12.3.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.3.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.3.0...v12.3.1) - Don't freeze signal when freezing Options ([#​2100](https://togithub.com/sindresorhus/got/issues/2100)) [`43b1467`](https://togithub.com/sindresorhus/got/commit/43b1467) ### [`v12.3.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.3.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.2.0...v12.3.0) - Add `.off()` method for events ([#​2092](https://togithub.com/sindresorhus/got/issues/2092)) [`88056be`](https://togithub.com/sindresorhus/got/commit/88056be) ### [`v12.2.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.2.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.1.0...v12.2.0) - [Support `AbortController`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#signal) ([#​2020](https://togithub.com/sindresorhus/got/issues/2020)) [`6a6d2a9`](https://togithub.com/sindresorhus/got/commit/6a6d2a9) - Add [`enableUnixSockets`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#enableunixsockets) option ([#​2062](https://togithub.com/sindresorhus/got/issues/2062)) [`461b3d4`](https://togithub.com/sindresorhus/got/commit/461b3d4) ### [`v12.1.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.1.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.4...v12.1.0) ##### Improvements - Add `response.ok` ([#​2043](https://togithub.com/sindresorhus/got/issues/2043)) [`22d58fb`](https://togithub.com/sindresorhus/got/commit/22d58fb) - This is only useful if you have [`{throwHttpErrors: false}`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#throwhttperrors) ##### Fixes - Do not redirect to UNIX sockets ([#​2047](https://togithub.com/sindresorhus/got/issues/2047)) [`861ccd9`](https://togithub.com/sindresorhus/got/commit/861ccd9) - [CVE-2022-33987](https://nvd.nist.gov/vuln/detail/CVE-2022-33987) - [Also back ported to v11](https://togithub.com/sindresorhus/got/releases/tag/v11.8.5) ### [`v12.0.4`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.4) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.3...v12.0.4) - Remove stream lock - unreliable since Node 17.3.0 [`bb8eca9`](https://togithub.com/sindresorhus/got/commit/bb8eca924c338ca12d5b90d6a26aa28dbddb42ee) ### [`v12.0.3`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.3) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.2...v12.0.3) - Allow more types in the `json` option ([#​2015](https://togithub.com/sindresorhus/got/issues/2015)) [`eb045bf`](https://togithub.com/sindresorhus/got/commit/eb045bf) ### [`v12.0.2`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.1...v12.0.2) - Fix `encoding` option with `{responseType: 'json'}` ([#​1996](https://togithub.com/sindresorhus/got/issues/1996)) [`0703318`](https://togithub.com/sindresorhus/got/commit/0703318) ### [`v12.0.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.0...v12.0.1) - Fix `nock` compatibility ([#​1959](https://togithub.com/sindresorhus/got/issues/1959)) [`bf39d2c`](https://togithub.com/sindresorhus/got/commit/bf39d2c) - Fix missing export of `Request` TypeScript type ([#​1940](https://togithub.com/sindresorhus/got/issues/1940)) [`0f9f2b8`](https://togithub.com/sindresorhus/got/commit/0f9f2b8) ### [`v12.0.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.8.6...v12.0.0) ##### Introducing Got v12.0.0 🎉 Long time no see! The latest Got version (v11.8.2) was released just in February ❄️ We have been working hard on squashing bugs and improving overall experience. If you find Got useful, you might want to [sponsor the Got maintainers](https://togithub.com/sindresorhus/got?sponsor=1). ##### This package is now pure ESM **Please [read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).** Also see [https://github.com/sindresorhus/got/issues/1789](https://togithub.com/sindresorhus/got/issues/1789). - **Please don't open issues about `[ERR_REQUIRE_ESM]` and `Must use import to load ES Module` errors.** This is a problem with your setup, not Got. - Please don't open issues about using Got with Jest. Jest does not fully support ESM. - Pretty much any problem with loading this package is a problem with your bundler, test framework, etc, not Got. - If you use TypeScript, you will want to stay on Got v11 until TypeScript 4.6 is out. [Why.](https://togithub.com/microsoft/TypeScript/issues/46452) - If you use a bundler, make sure it supports ESM and that you have correctly configured it for ESM. - The Got issue tracker is not a support channel for your favorite build/bundler tool. ##### Required Node.js >=14 While working with streams, we encountered more Node.js bugs that needed workarounds. In order to keep our code clean, we had to drop Node.js v12 as the code would get more messy. We strongly recommend that you update Node.js to **v14 LTS**. ##### HTTP/2 support Every Node.js release, the native `http2` module gets more stable. Unfortunately there are still some issues on the Node.js side, so we decided to keep HTTP/2 disabled for now. We may enable it by default in Got v13. It is still possible to turn it on via the `http2` option. To run HTTP/2 requests, it is required to use Node.js **v15.10** or above. ##### Bug fixes Woah, we possibly couldn't make a release if we didn't fix some bugs! - Do not throw on custom stack traces ([#​1491](https://togithub.com/sindresorhus/got/issues/1491)) [`49c16ee`](https://togithub.com/sindresorhus/got/commit/49c16ee54fb19ea7aa77e24ac8c2b602f0aad265) - Remove automatic `content-length` on ReadStream ([#​1510](https://togithub.com/sindresorhus/got/issues/1510)) [`472b8ef`](https://togithub.com/sindresorhus/got/commit/472b8ef9d9fc7713b740981a8b1103a7a9111b26) - Fix promise shortcuts in case of error status code ([#​1543](https://togithub.com/sindresorhus/got/issues/1543)) [`ff918fb`](https://togithub.com/sindresorhus/got/commit/ff918fb6dedb6d8b23421497ec890d43f45121b7) [`1107cc6`](https://togithub.com/sindresorhus/got/commit/1107cc625e4cc469276483316c48896a21f6251a) - Invert the `methodRewriting` option [`51d88a0`](https://togithub.com/sindresorhus/got/commit/51d88a0efed56760d116c5b911cea71e3265c787) - Fix `url` not being reused on retry in rare case ([#​1487](https://togithub.com/sindresorhus/got/issues/1487)) [`462bc63`](https://togithub.com/sindresorhus/got/commit/462bc630015064fa4ad4358cf28d24f95e1c958b) - Fix hanging promise on HTTP/2 timeout ([#​1492](https://togithub.com/sindresorhus/got/issues/1492)) [`a59fac4`](https://togithub.com/sindresorhus/got/commit/a59fac415ac013a48b1d514837628a5cf81d6878) - Prevent uncaught ParseErrors on initial successful response ([#​1527](https://togithub.com/sindresorhus/got/issues/1527)) [`77df9c3`](https://togithub.com/sindresorhus/got/commit/77df9c33db5ba3126f54317171e1cfcfceefc3d5) - Throw an error when retrying with consumed body ([#​1507](https://togithub.com/sindresorhus/got/issues/1507)) [`62305d7`](https://togithub.com/sindresorhus/got/commit/62305d77d3428b5c714d21b4bbee68cc75b5f787) - Fix a Node.js 16 bug that hangs Got streams [`06a2d3d`](https://togithub.com/sindresorhus/got/commit/06a2d3d7d8d4fcc6898b6364d1a18ca1d407092b) - Fix default pagination handling for empty Link header ([#​1768](https://togithub.com/sindresorhus/got/issues/1768)) [`1e1e506`](https://togithub.com/sindresorhus/got/commit/1e1e50647e93d038a4cc6a9bbbfbf61165d8fd39) - Fix incorrect `response.complete` when using cache [`9e15d88`](https://togithub.com/sindresorhus/got/commit/9e15d887da3b065940bbc8ca38f9c748a0bbc75e) - Fix `Cannot call end` error when `request` returns a `Writable` [`226cc39`](https://togithub.com/sindresorhus/got/commit/226cc3995f6e16938163ebde24d8762e7dcd15e2) - Fix Request options not being reused on retry [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Fix types being not compatible with CommonJS [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Fix `got.paginate does not call init hooks` ([#​1574](https://togithub.com/sindresorhus/got/issues/1574)) [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Generate a new object when passing options to the native `https` module ([#​1567](https://togithub.com/sindresorhus/got/issues/1567)) [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Remove stream reuse check ([#​1803](https://togithub.com/sindresorhus/got/issues/1803)) [`9ecc5ee`](https://togithub.com/sindresorhus/got/commit/9ecc5ee76f77aafd5100520d9d8789c491c8fb24) - Fix merging `searchParams` ([#​1814](https://togithub.com/sindresorhus/got/issues/1814)) [`1018c20`](https://togithub.com/sindresorhus/got/commit/1018c2029eea1f5b75b5120265996f1c0b3c12ae) [`732e9bd`](https://togithub.com/sindresorhus/got/commit/732e9bd9406ba1c3dd64b445264e891f33fc0254) - Fix unhandled exception when lookup returns invalid IP early ([#​1737](https://togithub.com/sindresorhus/got/issues/1737)) [`2453e5e`](https://togithub.com/sindresorhus/got/commit/2453e5e4213fe036a0108de3e4db414dcf2b4c30) - Fix relative URLs when paginating [`439fb82`](https://togithub.com/sindresorhus/got/commit/439fb82d2a07cece417a18c47e37cfdeaaf38db7) - Require url to be an instance of URL when paginating ([#​1818](https://togithub.com/sindresorhus/got/issues/1818)) [`eda69ff`](https://togithub.com/sindresorhus/got/commit/eda69ff924a621e499d31cbc590993a32ddb48d3) - Fix `username` and `password` encoding in URL ([#​1169](https://togithub.com/sindresorhus/got/issues/1169) [#​1317](https://togithub.com/sindresorhus/got/issues/1317)) [`d65d0ca`](https://togithub.com/sindresorhus/got/commit/d65d0caf627e8d1f5367db34d7d9b55d332c1efb) - Clone raw options [`1c4cefc`](https://togithub.com/sindresorhus/got/commit/1c4cefc9b49f891712c3758f853d8c6214a1c904) - Fix invalid `afterResponse` return check [`cbc8902`](https://togithub.com/sindresorhus/got/commit/cbc8902) - Fix `https.alpnProtocols` not having an effect [`e1099fb`](https://togithub.com/sindresorhus/got/commit/e1099fb) ##### Improvements - Make the `context` option mergeable ([#​1459](https://togithub.com/sindresorhus/got/issues/1459)) [`2b8ed1f`](https://togithub.com/sindresorhus/got/commit/2b8ed1f5a185f30603d24e2ceb8181782de3bc5a) - Add generic argument to AfterResponseHook TypeScript type ([#​1589](https://togithub.com/sindresorhus/got/issues/1589)) [`6fc04a9`](https://togithub.com/sindresorhus/got/commit/6fc04a9b92f07b07b9fba010f2231a90082a039b) - Add read timeout ([#​1518](https://togithub.com/sindresorhus/got/issues/1518)) [`e943672`](https://togithub.com/sindresorhus/got/commit/e9436720fcb32b77d39d5477b420b18083e41c02) *(blocked by [https://github.com/nodejs/node/issues/35923](https://togithub.com/nodejs/node/issues/35923))* - Improve the pagination API ([#​1644](https://togithub.com/sindresorhus/got/issues/1644)) [`2675046`](https://togithub.com/sindresorhus/got/commit/2675046a83c7f03613f553a8da2912d491be900d) - Change the stackAllItems option to be false by default ([#​1645](https://togithub.com/sindresorhus/got/issues/1645)) [`1120370`](https://togithub.com/sindresorhus/got/commit/1120370e05fd8d9e768677d8474d0c82cf91a6a6) - Throw when afterResponse hook returns an invalid value [`4f21eb3`](https://togithub.com/sindresorhus/got/commit/4f21eb3db705c90797ef8ee1503704f78fea3c1b) - Add `retry.backoffLimit` option [`41c4136`](https://togithub.com/sindresorhus/got/commit/41c4136632b9391adb3ac53332b312089bc4dc16) - Add `noise` retry option [`e830077`](https://togithub.com/sindresorhus/got/commit/e83007704670b5f567ca338c156441f6c569ecb5) - Enable more HTTPS options [`83575d5`](https://togithub.com/sindresorhus/got/commit/83575d590a119027d319bd9208681973087564a9) [`fe723a0`](https://togithub.com/sindresorhus/got/commit/fe723a0477dc02785a0b477e3d5f85d0233e5b84) (thanks [@​Giotino](https://togithub.com/Giotino)) - Define `error.code` [`f27e8d3`](https://togithub.com/sindresorhus/got/commit/f27e8d331627074e76e4a9ec85a2c8d0a0625e5f) - Set `options.url` even if some options are invalid [`8d6a680`](https://togithub.com/sindresorhus/got/commit/8d6a6807883323a83ea5f126ca56b55d9ce5f299) - Improve memory usage when merging options [`2db5ec5`](https://togithub.com/sindresorhus/got/commit/2db5ec5d366efbbf9e0838eabfa6be774a0518a0) - Support async generators as body [`854430f`](https://togithub.com/sindresorhus/got/commit/854430f01350811fe8a0ccf20cd820aabfbd3926) [`3df52f3`](https://togithub.com/sindresorhus/got/commit/3df52f38edbadb45158c37d499817bc5486989c6) - Add missing `once` types for Stream API [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - New error type: `RetryError` which always triggers a new retry when thrown [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - `error.options` is now enumerable [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - `defaults.handlers` don't need a default handler now [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Add a parser for the `Link` header [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - General code improvements [`a5dd9aa`](https://togithub.com/sindresorhus/got/commit/a5dd9aa37e7891b2620798560799c7f8bd380877) ##### Breaking changes ##### Improved option normalization - Got exports an `Option` class that is specifically designed to parse and validate Got options. It is made of setters and getters that provide fast normalization and more consistent behavior. When passing an option does not exist, Got will throw an error. In order to retrieve the options before the error, use `error.options`. ```js import got from 'got'; try { await got('https://httpbin.org/anything', { thisOptionDoesNotExist: true }); } catch (error) { console.error(error); console.error(error.options.url.href); // Unexpected option: thisOptionDoesNotExist // https://httpbin.org/anything } ``` - The `init` hook now accepts a second argument: `self`, which points to an `Options` instance. In order to define your own options, you have to move them to `options.context` in an [`init` hook](https://togithub.com/sindresorhus/got/blob/main/documentation/lets-make-a-plugin.md#authorization) or store them in `options.context` directly. - The `init` hooks are ran only when passing an options object explicitly. ```diff - await got('https://example.com'); // this will *not* trigger the init hooks + await got('https://example.com', {}); // this *will** trigger init hooks ``` - [`options.merge()`](2-options.md) replaced `got.mergeOptions` and `Request.normalizeArguments` ```diff - got.defaults.options = got.mergeOptions(got.defaults.options, {…}); + got.defaults.options.merge(…); ``` This fixes issues like [#​1450](https://togithub.com/sindresorhus/got/issues/1450) - Legacy `Url` instances are not supported anymore. You need to use WHATWG URL instead. ```diff - await got(string, {port: 8443}); + const url = new URL(string); + url.port = 8443; + await got(url); ``` - No implicit timeout declaration. ```diff - await got('https://example.com', {timeout: 5000}) + await got('https://example.com', {timeout: {request: 5000}) ``` - No implicit retry declaration. ```diff - await got('https://example.com', {retry: 5}) + await got('https://example.com', {retry: {limit: 5}) ``` - `dnsLookupIpVersion` is now a number (4 or 6) or undefined ```diff - await got('https://example.com', {dnsLookupIpVersion: 'ipv4'}) + await got('https://example.com', {dnsLookupIpVersion: 4}) ``` - `redirectUrls` and `requestUrl` now give URL instances ```diff - request.requestUrl + request.requestUrl.origin + request.requestUrl.href + request.requestUrl.toString() ``` ```diff - request.redirectUrls[0] + request.redirectUrls[0].origin + request.redirectUrls[0].href + request.redirectUrls[0].toString() ``` - Renamed `request.aborted` to `request.isAborted` ```diff - request.aborted + request.isAborted ``` Reason: consistency with `options.isStream`. - Renamed the `lookup` option to `dnsLookup` ```diff - await got('https://example.com', {lookup: cacheable.lookup}) + await got('https://example.com', {dnsLookup: cacheable.lookup}) ``` - The `beforeRetry` hook now accepts only two arguments: `error` and `retryCount` ```diff await got('https://example.com', { hooks: { beforeRetry: [ - (options, error, retryCount) => { - console.log(options, error, retryCount); - } + (error, retryCount) => { + console.log(error.options, error, retryCount); + } ] } }) ``` The `options` argument has been removed, however it's still accessible via `error.options`. All modifications on `error.options` will be reflected in the next requests (no behavior change, same as with Got 11). - The `beforeRedirect` hook's first argument (options) is now a cloned instance of the Request options. This was done to make retrieving the original options possible: `plainResponse.request.options`. ```diff await got('http://szmarczak.com', { hooks: { beforeRedirect: [ (options, response) => { - console.log(options === response.request.options); //=> true [invalid! our original options were overriden] + console.log(options === response.request.options); //=> false [we can access the original options now] } ] } }) ``` - The `redirect` event now takes two arguments in this order: `updatedOptions` and `plainResponse`. ```diff - stream.on('redirect', (response, options) => …) + stream.on('redirect', (options, response) => …) ``` Reason: consistency with the `beforeRedirect` hook. - The `socketPath` option has been removed. Use the `unix:` protocol instead. ```diff - got('/containers/json', {socketPath: '/var/run/docker.sock'}) + got('unix:/var/run/docker.sock:/containers/json') + got('http://unix:/var/run/docker.sock:/containers/json') ``` - The `retryWithMergedOptions` function in an `afterResponse` hook no longer returns a `Promise`. It now throws `RetryError`, so this should this should be the last function being executed. This was done to allow `beforeRetry` hooks getting called. - You can no longer set `options.agent` to `false`. To do so, you need to define all the `options.agent` properties: `http`, `https` and `http2`. ```diff await got('https://example.com', { - agent: false + agent: { + http: false, + https: false, + http2: false + } }) ``` - When passing a `url` option when paginating, it now needs to be an absolute URL - the `prefixUrl` option is always reset from now on. The same when retrying in an `afterResponse` hook. ```diff - return {url: '/location'}; + return {url: new URL('/location', response.request.options.url)}; ``` There was confusion around the `prefixUrl` option. It was counterintuitive if used with the Pagination API. For example, it worked fine if the server replied with a relative URL, but if it was an absolute URL then the `prefixUrl` would end up duplicated. In order to fix this, Got now requires an absolute URL - no `prefixUrl` will be applied. - `got.extend(…)` will throw when passing some options that don't accept undefined - undefined no longer retains the old value, as setting undefined explicitly may reset the option ##### Documentation We have redesigned the documentation so it's easier to navigate and find exactly what you are looking for. We hope you like it ❤️ </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Unleash/unleash). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMTAuMCIsInVwZGF0ZWRJblZlciI6IjM1LjEzMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Vylpes
pushed a commit
to Vylpes/random-bunny
that referenced
this issue
Sep 5, 2023
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [got](https://github.com/sindresorhus/got) | resolutions | major | [`^11.8.5` -> `^13.0.0`](https://renovatebot.com/diffs/npm/got/11.8.6/13.0.0) | --- ### Release Notes <details> <summary>sindresorhus/got</summary> ### [`v13.0.0`](https://github.com/sindresorhus/got/releases/tag/v13.0.0) [Compare Source](sindresorhus/got@v12.6.1...v13.0.0) As a reminder, Got continues to require ESM. For TypeScript users, this includes having [`"module": "node16", "moduleResolution": "node16"` in your tsconfig](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-make-my-typescript-project-output-esm). ##### Breaking - Require Node.js 16 [`52a1063`](sindresorhus/got@52a1063) - Change the [`enableUnixSockets`](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md#enableunixsockets) option to be `false` by default [`852c312`](sindresorhus/got@852c312) - Most users don't need it. ##### Improvements - Allow specifying `undefined` for options ([#​2258](sindresorhus/got#2258)) [`1cefe8b`](sindresorhus/got@1cefe8b) ### [`v12.6.1`](https://github.com/sindresorhus/got/releases/tag/v12.6.1) [Compare Source](sindresorhus/got@v12.6.0...v12.6.1) - Fix `get-stream` import statement ([#​2266](sindresorhus/got#2266)) [`67d5039`](sindresorhus/got@67d5039) ### [`v12.6.0`](https://github.com/sindresorhus/got/releases/tag/v12.6.0) [Compare Source](sindresorhus/got@v12.5.3...v12.6.0) - Update dependencies [`88c88fb`](sindresorhus/got@88c88fb) [`979272e`](sindresorhus/got@979272e) - Loosen URL validation strictness ([#​2200](sindresorhus/got#2200)) [`0ca0b7f`](sindresorhus/got@0ca0b7f) ### [`v12.5.3`](https://github.com/sindresorhus/got/releases/tag/v12.5.3) [Compare Source](sindresorhus/got@v12.5.2...v12.5.3) - Fix abort event listeners not always being cleaned up ([#​2162](sindresorhus/got#2162)) [`3cc40b5`](sindresorhus/got@3cc40b5) ### [`v12.5.2`](https://github.com/sindresorhus/got/releases/tag/v12.5.2) [Compare Source](sindresorhus/got@v12.5.1...v12.5.2) - Improve TypeScript 4.9 compatibility ([#​2163](sindresorhus/got#2163)) [`39f83b6`](sindresorhus/got@39f83b6) ### [`v12.5.1`](https://github.com/sindresorhus/got/releases/tag/v12.5.1) [Compare Source](sindresorhus/got@v12.5.0...v12.5.1) - Fix compatibility with TypeScript and ESM [`3b3ea67`](sindresorhus/got@3b3ea67) - Fix request body not being properly cached ([#​2150](sindresorhus/got#2150)) [`3e9d3af`](sindresorhus/got@3e9d3af) ### [`v12.5.0`](https://github.com/sindresorhus/got/releases/tag/v12.5.0) [Compare Source](sindresorhus/got@v12.4.1...v12.5.0) - Disable method rewriting on 307 and 308 status codes ([#​2145](sindresorhus/got#2145)) [`e049e94`](sindresorhus/got@e049e94) - Upgrade dependencies [`8630815`](sindresorhus/got@8630815) [`f0ac0b3`](sindresorhus/got@f0ac0b3) [`4c3762a`](sindresorhus/got@4c3762a) ### [`v12.4.1`](https://github.com/sindresorhus/got/releases/tag/v12.4.1) [Compare Source](sindresorhus/got@v12.4.0...v12.4.1) ##### Fixes - Fix `options.context` being not extensible [`b671480`](sindresorhus/got@b671480) - Don't emit `uploadProgress` after promise cancelation [`693de21`](sindresorhus/got@693de21) ### [`v12.4.0`](https://github.com/sindresorhus/got/releases/tag/v12.4.0) [Compare Source](sindresorhus/got@v12.3.1...v12.4.0) ##### Improvements - Support FormData without known length ([#​2120](sindresorhus/got#2120)) [`850773c`](sindresorhus/got@850773c) ##### Fixes - Don't call `beforeError` hooks with `HTTPError` if the `throwHttpErrors` option is `false` ([#​2104](sindresorhus/got#2104)) [`3927348`](sindresorhus/got@3927348) ### [`v12.3.1`](https://github.com/sindresorhus/got/releases/tag/v12.3.1) [Compare Source](sindresorhus/got@v12.3.0...v12.3.1) - Don't freeze signal when freezing Options ([#​2100](sindresorhus/got#2100)) [`43b1467`](sindresorhus/got@43b1467) ### [`v12.3.0`](https://github.com/sindresorhus/got/releases/tag/v12.3.0) [Compare Source](sindresorhus/got@v12.2.0...v12.3.0) - Add `.off()` method for events ([#​2092](sindresorhus/got#2092)) [`88056be`](sindresorhus/got@88056be) ### [`v12.2.0`](https://github.com/sindresorhus/got/releases/tag/v12.2.0) [Compare Source](sindresorhus/got@v12.1.0...v12.2.0) - [Support `AbortController`](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md#signal) ([#​2020](sindresorhus/got#2020)) [`6a6d2a9`](sindresorhus/got@6a6d2a9) - Add [`enableUnixSockets`](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md#enableunixsockets) option ([#​2062](sindresorhus/got#2062)) [`461b3d4`](sindresorhus/got@461b3d4) ### [`v12.1.0`](https://github.com/sindresorhus/got/releases/tag/v12.1.0) [Compare Source](sindresorhus/got@v12.0.4...v12.1.0) ##### Improvements - Add `response.ok` ([#​2043](sindresorhus/got#2043)) [`22d58fb`](sindresorhus/got@22d58fb) - This is only useful if you have [`{throwHttpErrors: false}`](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md#throwhttperrors) ##### Fixes - Do not redirect to UNIX sockets ([#​2047](sindresorhus/got#2047)) [`861ccd9`](sindresorhus/got@861ccd9) - [CVE-2022-33987](https://nvd.nist.gov/vuln/detail/CVE-2022-33987) - [Also back ported to v11](https://github.com/sindresorhus/got/releases/tag/v11.8.5) ### [`v12.0.4`](https://github.com/sindresorhus/got/releases/tag/v12.0.4) [Compare Source](sindresorhus/got@v12.0.3...v12.0.4) - Remove stream lock - unreliable since Node 17.3.0 [`bb8eca9`](sindresorhus/got@bb8eca9) ### [`v12.0.3`](https://github.com/sindresorhus/got/releases/tag/v12.0.3) [Compare Source](sindresorhus/got@v12.0.2...v12.0.3) - Allow more types in the `json` option ([#​2015](sindresorhus/got#2015)) [`eb045bf`](sindresorhus/got@eb045bf) ### [`v12.0.2`](https://github.com/sindresorhus/got/releases/tag/v12.0.2) [Compare Source](sindresorhus/got@v12.0.1...v12.0.2) - Fix `encoding` option with `{responseType: 'json'}` ([#​1996](sindresorhus/got#1996)) [`0703318`](sindresorhus/got@0703318) ### [`v12.0.1`](https://github.com/sindresorhus/got/releases/tag/v12.0.1) [Compare Source](sindresorhus/got@v12.0.0...v12.0.1) - Fix `nock` compatibility ([#​1959](sindresorhus/got#1959)) [`bf39d2c`](sindresorhus/got@bf39d2c) - Fix missing export of `Request` TypeScript type ([#​1940](sindresorhus/got#1940)) [`0f9f2b8`](sindresorhus/got@0f9f2b8) ### [`v12.0.0`](https://github.com/sindresorhus/got/releases/tag/v12.0.0) [Compare Source](sindresorhus/got@v11.8.6...v12.0.0) ##### Introducing Got v12.0.0 🎉 Long time no see! The latest Got version (v11.8.2) was released just in February ❄️ We have been working hard on squashing bugs and improving overall experience. If you find Got useful, you might want to [sponsor the Got maintainers](https://github.com/sindresorhus/got?sponsor=1). ##### This package is now pure ESM **Please [read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).** Also see sindresorhus/got#1789. - **Please don't open issues about `[ERR_REQUIRE_ESM]` and `Must use import to load ES Module` errors.** This is a problem with your setup, not Got. - Please don't open issues about using Got with Jest. Jest does not fully support ESM. - Pretty much any problem with loading this package is a problem with your bundler, test framework, etc, not Got. - If you use TypeScript, you will want to stay on Got v11 until TypeScript 4.6 is out. [Why.](microsoft/TypeScript#46452) - If you use a bundler, make sure it supports ESM and that you have correctly configured it for ESM. - The Got issue tracker is not a support channel for your favorite build/bundler tool. ##### Required Node.js >=14 While working with streams, we encountered more Node.js bugs that needed workarounds. In order to keep our code clean, we had to drop Node.js v12 as the code would get more messy. We strongly recommend that you update Node.js to **v14 LTS**. ##### HTTP/2 support Every Node.js release, the native `http2` module gets more stable. Unfortunately there are still some issues on the Node.js side, so we decided to keep HTTP/2 disabled for now. We may enable it by default in Got v13. It is still possible to turn it on via the `http2` option. To run HTTP/2 requests, it is required to use Node.js **v15.10** or above. ##### Bug fixes Woah, we possibly couldn't make a release if we didn't fix some bugs! - Do not throw on custom stack traces ([#​1491](sindresorhus/got#1491)) [`49c16ee`](sindresorhus/got@49c16ee) - Remove automatic `content-length` on ReadStream ([#​1510](sindresorhus/got#1510)) [`472b8ef`](sindresorhus/got@472b8ef) - Fix promise shortcuts in case of error status code ([#​1543](sindresorhus/got#1543)) [`ff918fb`](sindresorhus/got@ff918fb) [`1107cc6`](sindresorhus/got@1107cc6) - Invert the `methodRewriting` option [`51d88a0`](sindresorhus/got@51d88a0) - Fix `url` not being reused on retry in rare case ([#​1487](sindresorhus/got#1487)) [`462bc63`](sindresorhus/got@462bc63) - Fix hanging promise on HTTP/2 timeout ([#​1492](sindresorhus/got#1492)) [`a59fac4`](sindresorhus/got@a59fac4) - Prevent uncaught ParseErrors on initial successful response ([#​1527](sindresorhus/got#1527)) [`77df9c3`](sindresorhus/got@77df9c3) - Throw an error when retrying with consumed body ([#​1507](sindresorhus/got#1507)) [`62305d7`](sindresorhus/got@62305d7) - Fix a Node.js 16 bug that hangs Got streams [`06a2d3d`](sindresorhus/got@06a2d3d) - Fix default pagination handling for empty Link header ([#​1768](sindresorhus/got#1768)) [`1e1e506`](sindresorhus/got@1e1e506) - Fix incorrect `response.complete` when using cache [`9e15d88`](sindresorhus/got@9e15d88) - Fix `Cannot call end` error when `request` returns a `Writable` [`226cc39`](sindresorhus/got@226cc39) - Fix Request options not being reused on retry [`3c23eea`](sindresorhus/got@3c23eea) - Fix types being not compatible with CommonJS [`3c23eea`](sindresorhus/got@3c23eea) - Fix `got.paginate does not call init hooks` ([#​1574](sindresorhus/got#1574)) [`3c23eea`](sindresorhus/got@3c23eea) - Generate a new object when passing options to the native `https` module ([#​1567](sindresorhus/got#1567)) [`3c23eea`](sindresorhus/got@3c23eea) - Remove stream reuse check ([#​1803](sindresorhus/got#1803)) [`9ecc5ee`](sindresorhus/got@9ecc5ee) - Fix merging `searchParams` ([#​1814](sindresorhus/got#1814)) [`1018c20`](sindresorhus/got@1018c20) [`732e9bd`](sindresorhus/got@732e9bd) - Fix unhandled exception when lookup returns invalid IP early ([#​1737](sindresorhus/got#1737)) [`2453e5e`](sindresorhus/got@2453e5e) - Fix relative URLs when paginating [`439fb82`](sindresorhus/got@439fb82) - Require url to be an instance of URL when paginating ([#​1818](sindresorhus/got#1818)) [`eda69ff`](sindresorhus/got@eda69ff) - Fix `username` and `password` encoding in URL ([#​1169](sindresorhus/got#1169) [#​1317](sindresorhus/got#1317)) [`d65d0ca`](sindresorhus/got@d65d0ca) - Clone raw options [`1c4cefc`](sindresorhus/got@1c4cefc) - Fix invalid `afterResponse` return check [`cbc8902`](sindresorhus/got@cbc8902) - Fix `https.alpnProtocols` not having an effect [`e1099fb`](sindresorhus/got@e1099fb) ##### Improvements - Make the `context` option mergeable ([#​1459](sindresorhus/got#1459)) [`2b8ed1f`](sindresorhus/got@2b8ed1f) - Add generic argument to AfterResponseHook TypeScript type ([#​1589](sindresorhus/got#1589)) [`6fc04a9`](sindresorhus/got@6fc04a9) - Add read timeout ([#​1518](sindresorhus/got#1518)) [`e943672`](sindresorhus/got@e943672) *(blocked by nodejs/node#35923 - Improve the pagination API ([#​1644](sindresorhus/got#1644)) [`2675046`](sindresorhus/got@2675046) - Change the stackAllItems option to be false by default ([#​1645](sindresorhus/got#1645)) [`1120370`](sindresorhus/got@1120370) - Throw when afterResponse hook returns an invalid value [`4f21eb3`](sindresorhus/got@4f21eb3) - Add `retry.backoffLimit` option [`41c4136`](sindresorhus/got@41c4136) - Add `noise` retry option [`e830077`](sindresorhus/got@e830077) - Enable more HTTPS options [`83575d5`](sindresorhus/got@83575d5) [`fe723a0`](sindresorhus/got@fe723a0) (thanks [@​Giotino](https://github.com/Giotino)) - Define `error.code` [`f27e8d3`](sindresorhus/got@f27e8d3) - Set `options.url` even if some options are invalid [`8d6a680`](sindresorhus/got@8d6a680) - Improve memory usage when merging options [`2db5ec5`](sindresorhus/got@2db5ec5) - Support async generators as body [`854430f`](sindresorhus/got@854430f) [`3df52f3`](sindresorhus/got@3df52f3) - Add missing `once` types for Stream API [`3c23eea`](sindresorhus/got@3c23eea) - New error type: `RetryError` which always triggers a new retry when thrown [`3c23eea`](sindresorhus/got@3c23eea) - `error.options` is now enumerable [`3c23eea`](sindresorhus/got@3c23eea) - `defaults.handlers` don't need a default handler now [`3c23eea`](sindresorhus/got@3c23eea) - Add a parser for the `Link` header [`3c23eea`](sindresorhus/got@3c23eea) - General code improvements [`a5dd9aa`](sindresorhus/got@a5dd9aa) ##### Breaking changes ##### Improved option normalization - Got exports an `Option` class that is specifically designed to parse and validate Got options. It is made of setters and getters that provide fast normalization and more consistent behavior. When passing an option does not exist, Got will throw an error. In order to retrieve the options before the error, use `error.options`. ```js import got from 'got'; try { await got('https://httpbin.org/anything', { thisOptionDoesNotExist: true }); } catch (error) { console.error(error); console.error(error.options.url.href); // Unexpected option: thisOptionDoesNotExist // https://httpbin.org/anything } ``` - The `init` hook now accepts a second argument: `self`, which points to an `Options` instance. In order to define your own options, you have to move them to `options.context` in an [`init` hook](https://github.com/sindresorhus/got/blob/main/documentation/lets-make-a-plugin.md#authorization) or store them in `options.context` directly. - The `init` hooks are ran only when passing an options object explicitly. ```diff - await got('https://example.com'); // this will *not* trigger the init hooks + await got('https://example.com', {}); // this *will** trigger init hooks ``` - [`options.merge()`](2-options.md) replaced `got.mergeOptions` and `Request.normalizeArguments` ```diff - got.defaults.options = got.mergeOptions(got.defaults.options, {…}); + got.defaults.options.merge(…); ``` This fixes issues like [#​1450](sindresorhus/got#1450) - Legacy `Url` instances are not supported anymore. You need to use WHATWG URL instead. ```diff - await got(string, {port: 8443}); + const url = new URL(string); + url.port = 8443; + await got(url); ``` - No implicit timeout declaration. ```diff - await got('https://example.com', {timeout: 5000}) + await got('https://example.com', {timeout: {request: 5000}) ``` - No implicit retry declaration. ```diff - await got('https://example.com', {retry: 5}) + await got('https://example.com', {retry: {limit: 5}) ``` - `dnsLookupIpVersion` is now a number (4 or 6) or undefined ```diff - await got('https://example.com', {dnsLookupIpVersion: 'ipv4'}) + await got('https://example.com', {dnsLookupIpVersion: 4}) ``` - `redirectUrls` and `requestUrl` now give URL instances ```diff - request.requestUrl + request.requestUrl.origin + request.requestUrl.href + request.requestUrl.toString() ``` ```diff - request.redirectUrls[0] + request.redirectUrls[0].origin + request.redirectUrls[0].href + request.redirectUrls[0].toString() ``` - Renamed `request.aborted` to `request.isAborted` ```diff - request.aborted + request.isAborted ``` Reason: consistency with `options.isStream`. - Renamed the `lookup` option to `dnsLookup` ```diff - await got('https://example.com', {lookup: cacheable.lookup}) + await got('https://example.com', {dnsLookup: cacheable.lookup}) ``` - The `beforeRetry` hook now accepts only two arguments: `error` and `retryCount` ```diff await got('https://example.com', { hooks: { beforeRetry: [ - (options, error, retryCount) => { - console.log(options, error, retryCount); - } + (error, retryCount) => { + console.log(error.options, error, retryCount); + } ] } }) ``` The `options` argument has been removed, however it's still accessible via `error.options`. All modifications on `error.options` will be reflected in the next requests (no behavior change, same as with Got 11). - The `beforeRedirect` hook's first argument (options) is now a cloned instance of the Request options. This was done to make retrieving the original options possible: `plainResponse.request.options`. ```diff await got('http://szmarczak.com', { hooks: { beforeRedirect: [ (options, response) => { - console.log(options === response.request.options); //=> true [invalid! our original options were overriden] + console.log(options === response.request.options); //=> false [we can access the original options now] } ] } }) ``` - The `redirect` event now takes two arguments in this order: `updatedOptions` and `plainResponse`. ```diff - stream.on('redirect', (response, options) => …) + stream.on('redirect', (options, response) => …) ``` Reason: consistency with the `beforeRedirect` hook. - The `socketPath` option has been removed. Use the `unix:` protocol instead. ```diff - got('/containers/json', {socketPath: '/var/run/docker.sock'}) + got('unix:/var/run/docker.sock:/containers/json') + got('http://unix:/var/run/docker.sock:/containers/json') ``` - The `retryWithMergedOptions` function in an `afterResponse` hook no longer returns a `Promise`. It now throws `RetryError`, so this should this should be the last function being executed. This was done to allow `beforeRetry` hooks getting called. - You can no longer set `options.agent` to `false`. To do so, you need to define all the `options.agent` properties: `http`, `https` and `http2`. ```diff await got('https://example.com', { - agent: false + agent: { + http: false, + https: false, + http2: false + } }) ``` - When passing a `url` option when paginating, it now needs to be an absolute URL - the `prefixUrl` option is always reset from now on. The same when retrying in an `afterResponse` hook. ```diff - return {url: '/location'}; + return {url: new URL('/location', response.request.options.url)}; ``` There was confusion around the `prefixUrl` option. It was counterintuitive if used with the Pagination API. For example, it worked fine if the server replied with a relative URL, but if it was an absolute URL then the `prefixUrl` would end up duplicated. In order to fix this, Got now requires an absolute URL - no `prefixUrl` will be applied. - `got.extend(…)` will throw when passing some options that don't accept undefined - undefined no longer retains the old value, as setting undefined explicitly may reset the option ##### Documentation We have redesigned the documentation so it's easier to navigate and find exactly what you are looking for. We hope you like it ❤️ </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC43NC4yIiwidXBkYXRlZEluVmVyIjoiMzQuNzQuMiJ9--> Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/66 Co-authored-by: Renovate Bot <renovate@vylpes.com> Co-committed-by: Renovate Bot <renovate@vylpes.com>
kodiakhq bot
referenced
this issue
in X-oss-byte/Canary-nextjs
Oct 7, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [got](https://togithub.com/sindresorhus/got) | [`11.8.6` -> `13.0.0`](https://renovatebot.com/diffs/npm/got/11.8.6/13.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/got/13.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/got/13.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/got/11.8.6/13.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/got/11.8.6/13.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### ⚠ Dependency Lookup Warnings ⚠ Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>sindresorhus/got (got)</summary> ### [`v13.0.0`](https://togithub.com/sindresorhus/got/releases/tag/v13.0.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/c405f5407863ef8faca3af397204d6f192a56320...b1d61c173a681755ac23afb2f155f08801c1e7e4) As a reminder, Got continues to require ESM. For TypeScript users, this includes having [`"module": "node16", "moduleResolution": "node16"` in your tsconfig](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-make-my-typescript-project-output-esm). ##### Breaking - Require Node.js 16 [`52a1063`](https://togithub.com/sindresorhus/got/commit/52a1063) - Change the [`enableUnixSockets`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#enableunixsockets) option to be `false` by default [`852c312`](https://togithub.com/sindresorhus/got/commit/852c312) - Most users don't need it. ##### Improvements - Allow specifying `undefined` for options ([#​2258](https://togithub.com/sindresorhus/got/issues/2258)) [`1cefe8b`](https://togithub.com/sindresorhus/got/commit/1cefe8b) ### [`v12.6.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.6.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.6.0...v12.6.1) - Fix `get-stream` import statement ([#​2266](https://togithub.com/sindresorhus/got/issues/2266)) [`67d5039`](https://togithub.com/sindresorhus/got/commit/67d5039) ### [`v12.6.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.6.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.3...v12.6.0) - Update dependencies [`88c88fb`](https://togithub.com/sindresorhus/got/commit/88c88fb) [`979272e`](https://togithub.com/sindresorhus/got/commit/979272e) - Loosen URL validation strictness ([#​2200](https://togithub.com/sindresorhus/got/issues/2200)) [`0ca0b7f`](https://togithub.com/sindresorhus/got/commit/0ca0b7f) ### [`v12.5.3`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.3) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.2...v12.5.3) - Fix abort event listeners not always being cleaned up ([#​2162](https://togithub.com/sindresorhus/got/issues/2162)) [`3cc40b5`](https://togithub.com/sindresorhus/got/commit/3cc40b5) ### [`v12.5.2`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.1...v12.5.2) - Improve TypeScript 4.9 compatibility ([#​2163](https://togithub.com/sindresorhus/got/issues/2163)) [`39f83b6`](https://togithub.com/sindresorhus/got/commit/39f83b6) ### [`v12.5.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.0...v12.5.1) - Fix compatibility with TypeScript and ESM [`3b3ea67`](https://togithub.com/sindresorhus/got/commit/3b3ea67) - Fix request body not being properly cached ([#​2150](https://togithub.com/sindresorhus/got/issues/2150)) [`3e9d3af`](https://togithub.com/sindresorhus/got/commit/3e9d3af) ### [`v12.5.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.4.1...v12.5.0) - Disable method rewriting on 307 and 308 status codes ([#​2145](https://togithub.com/sindresorhus/got/issues/2145)) [`e049e94`](https://togithub.com/sindresorhus/got/commit/e049e94) - Upgrade dependencies [`8630815`](https://togithub.com/sindresorhus/got/commit/8630815) [`f0ac0b3`](https://togithub.com/sindresorhus/got/commit/f0ac0b3) [`4c3762a`](https://togithub.com/sindresorhus/got/commit/4c3762a) ### [`v12.4.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.4.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.4.0...v12.4.1) ##### Fixes - Fix `options.context` being not extensible [`b671480`](https://togithub.com/sindresorhus/got/commit/b671480715dbbff908e9a385f5e714570c663cd7) - Don't emit `uploadProgress` after promise cancelation [`693de21`](https://togithub.com/sindresorhus/got/commit/693de217b030816f574d6e4cb505ee2e77b21c29) ### [`v12.4.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.4.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.3.1...v12.4.0) ##### Improvements - Support FormData without known length ([#​2120](https://togithub.com/sindresorhus/got/issues/2120)) [`850773c`](https://togithub.com/sindresorhus/got/commit/850773c) ##### Fixes - Don't call `beforeError` hooks with `HTTPError` if the `throwHttpErrors` option is `false` ([#​2104](https://togithub.com/sindresorhus/got/issues/2104)) [`3927348`](https://togithub.com/sindresorhus/got/commit/3927348) ### [`v12.3.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.3.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.3.0...v12.3.1) - Don't freeze signal when freezing Options ([#​2100](https://togithub.com/sindresorhus/got/issues/2100)) [`43b1467`](https://togithub.com/sindresorhus/got/commit/43b1467) ### [`v12.3.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.3.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.2.0...v12.3.0) - Add `.off()` method for events ([#​2092](https://togithub.com/sindresorhus/got/issues/2092)) [`88056be`](https://togithub.com/sindresorhus/got/commit/88056be) ### [`v12.2.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.2.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.1.0...v12.2.0) - [Support `AbortController`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#signal) ([#​2020](https://togithub.com/sindresorhus/got/issues/2020)) [`6a6d2a9`](https://togithub.com/sindresorhus/got/commit/6a6d2a9) - Add [`enableUnixSockets`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#enableunixsockets) option ([#​2062](https://togithub.com/sindresorhus/got/issues/2062)) [`461b3d4`](https://togithub.com/sindresorhus/got/commit/461b3d4) ### [`v12.1.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.1.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.4...v12.1.0) ##### Improvements - Add `response.ok` ([#​2043](https://togithub.com/sindresorhus/got/issues/2043)) [`22d58fb`](https://togithub.com/sindresorhus/got/commit/22d58fb) - This is only useful if you have [`{throwHttpErrors: false}`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#throwhttperrors) ##### Fixes - Do not redirect to UNIX sockets ([#​2047](https://togithub.com/sindresorhus/got/issues/2047)) [`861ccd9`](https://togithub.com/sindresorhus/got/commit/861ccd9) - [CVE-2022-33987](https://nvd.nist.gov/vuln/detail/CVE-2022-33987) - [Also back ported to v11](https://togithub.com/sindresorhus/got/releases/tag/v11.8.5) ### [`v12.0.4`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.4) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.3...v12.0.4) - Remove stream lock - unreliable since Node 17.3.0 [`bb8eca9`](https://togithub.com/sindresorhus/got/commit/bb8eca924c338ca12d5b90d6a26aa28dbddb42ee) ### [`v12.0.3`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.3) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.2...v12.0.3) - Allow more types in the `json` option ([#​2015](https://togithub.com/sindresorhus/got/issues/2015)) [`eb045bf`](https://togithub.com/sindresorhus/got/commit/eb045bf) ### [`v12.0.2`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.1...v12.0.2) - Fix `encoding` option with `{responseType: 'json'}` ([#​1996](https://togithub.com/sindresorhus/got/issues/1996)) [`0703318`](https://togithub.com/sindresorhus/got/commit/0703318) ### [`v12.0.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.0...v12.0.1) - Fix `nock` compatibility ([#​1959](https://togithub.com/sindresorhus/got/issues/1959)) [`bf39d2c`](https://togithub.com/sindresorhus/got/commit/bf39d2c) - Fix missing export of `Request` TypeScript type ([#​1940](https://togithub.com/sindresorhus/got/issues/1940)) [`0f9f2b8`](https://togithub.com/sindresorhus/got/commit/0f9f2b8) ### [`v12.0.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.8.6...v12.0.0) ##### Introducing Got v12.0.0 🎉 Long time no see! The latest Got version (v11.8.2) was released just in February ❄️ We have been working hard on squashing bugs and improving overall experience. If you find Got useful, you might want to [sponsor the Got maintainers](https://togithub.com/sindresorhus/got?sponsor=1). ##### This package is now pure ESM **Please [read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).** Also see [https://github.com/sindresorhus/got/issues/1789](https://togithub.com/sindresorhus/got/issues/1789). - **Please don't open issues about `[ERR_REQUIRE_ESM]` and `Must use import to load ES Module` errors.** This is a problem with your setup, not Got. - Please don't open issues about using Got with Jest. Jest does not fully support ESM. - Pretty much any problem with loading this package is a problem with your bundler, test framework, etc, not Got. - If you use TypeScript, you will want to stay on Got v11 until TypeScript 4.6 is out. [Why.](https://togithub.com/microsoft/TypeScript/issues/46452) - If you use a bundler, make sure it supports ESM and that you have correctly configured it for ESM. - The Got issue tracker is not a support channel for your favorite build/bundler tool. ##### Required Node.js >=14 While working with streams, we encountered more Node.js bugs that needed workarounds. In order to keep our code clean, we had to drop Node.js v12 as the code would get more messy. We strongly recommend that you update Node.js to **v14 LTS**. ##### HTTP/2 support Every Node.js release, the native `http2` module gets more stable. Unfortunately there are still some issues on the Node.js side, so we decided to keep HTTP/2 disabled for now. We may enable it by default in Got v13. It is still possible to turn it on via the `http2` option. To run HTTP/2 requests, it is required to use Node.js **v15.10** or above. ##### Bug fixes Woah, we possibly couldn't make a release if we didn't fix some bugs! - Do not throw on custom stack traces ([#​1491](https://togithub.com/sindresorhus/got/issues/1491)) [`49c16ee`](https://togithub.com/sindresorhus/got/commit/49c16ee54fb19ea7aa77e24ac8c2b602f0aad265) - Remove automatic `content-length` on ReadStream ([#​1510](https://togithub.com/sindresorhus/got/issues/1510)) [`472b8ef`](https://togithub.com/sindresorhus/got/commit/472b8ef9d9fc7713b740981a8b1103a7a9111b26) - Fix promise shortcuts in case of error status code ([#​1543](https://togithub.com/sindresorhus/got/issues/1543)) [`ff918fb`](https://togithub.com/sindresorhus/got/commit/ff918fb6dedb6d8b23421497ec890d43f45121b7) [`1107cc6`](https://togithub.com/sindresorhus/got/commit/1107cc625e4cc469276483316c48896a21f6251a) - Invert the `methodRewriting` option [`51d88a0`](https://togithub.com/sindresorhus/got/commit/51d88a0efed56760d116c5b911cea71e3265c787) - Fix `url` not being reused on retry in rare case ([#​1487](https://togithub.com/sindresorhus/got/issues/1487)) [`462bc63`](https://togithub.com/sindresorhus/got/commit/462bc630015064fa4ad4358cf28d24f95e1c958b) - Fix hanging promise on HTTP/2 timeout ([#​1492](https://togithub.com/sindresorhus/got/issues/1492)) [`a59fac4`](https://togithub.com/sindresorhus/got/commit/a59fac415ac013a48b1d514837628a5cf81d6878) - Prevent uncaught ParseErrors on initial successful response ([#​1527](https://togithub.com/sindresorhus/got/issues/1527)) [`77df9c3`](https://togithub.com/sindresorhus/got/commit/77df9c33db5ba3126f54317171e1cfcfceefc3d5) - Throw an error when retrying with consumed body ([#​1507](https://togithub.com/sindresorhus/got/issues/1507)) [`62305d7`](https://togithub.com/sindresorhus/got/commit/62305d77d3428b5c714d21b4bbee68cc75b5f787) - Fix a Node.js 16 bug that hangs Got streams [`06a2d3d`](https://togithub.com/sindresorhus/got/commit/06a2d3d7d8d4fcc6898b6364d1a18ca1d407092b) - Fix default pagination handling for empty Link header ([#​1768](https://togithub.com/sindresorhus/got/issues/1768)) [`1e1e506`](https://togithub.com/sindresorhus/got/commit/1e1e50647e93d038a4cc6a9bbbfbf61165d8fd39) - Fix incorrect `response.complete` when using cache [`9e15d88`](https://togithub.com/sindresorhus/got/commit/9e15d887da3b065940bbc8ca38f9c748a0bbc75e) - Fix `Cannot call end` error when `request` returns a `Writable` [`226cc39`](https://togithub.com/sindresorhus/got/commit/226cc3995f6e16938163ebde24d8762e7dcd15e2) - Fix Request options not being reused on retry [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Fix types being not compatible with CommonJS [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Fix `got.paginate does not call init hooks` ([#​1574](https://togithub.com/sindresorhus/got/issues/1574)) [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Generate a new object when passing options to the native `https` module ([#​1567](https://togithub.com/sindresorhus/got/issues/1567)) [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Remove stream reuse check ([#​1803](https://togithub.com/sindresorhus/got/issues/1803)) [`9ecc5ee`](https://togithub.com/sindresorhus/got/commit/9ecc5ee76f77aafd5100520d9d8789c491c8fb24) - Fix merging `searchParams` ([#​1814](https://togithub.com/sindresorhus/got/issues/1814)) [`1018c20`](https://togithub.com/sindresorhus/got/commit/1018c2029eea1f5b75b5120265996f1c0b3c12ae) [`732e9bd`](https://togithub.com/sindresorhus/got/commit/732e9bd9406ba1c3dd64b445264e891f33fc0254) - Fix unhandled exception when lookup returns invalid IP early ([#​1737](https://togithub.com/sindresorhus/got/issues/1737)) [`2453e5e`](https://togithub.com/sindresorhus/got/commit/2453e5e4213fe036a0108de3e4db414dcf2b4c30) - Fix relative URLs when paginating [`439fb82`](https://togithub.com/sindresorhus/got/commit/439fb82d2a07cece417a18c47e37cfdeaaf38db7) - Require url to be an instance of URL when paginating ([#​1818](https://togithub.com/sindresorhus/got/issues/1818)) [`eda69ff`](https://togithub.com/sindresorhus/got/commit/eda69ff924a621e499d31cbc590993a32ddb48d3) - Fix `username` and `password` encoding in URL ([#​1169](https://togithub.com/sindresorhus/got/issues/1169) [#​1317](https://togithub.com/sindresorhus/got/issues/1317)) [`d65d0ca`](https://togithub.com/sindresorhus/got/commit/d65d0caf627e8d1f5367db34d7d9b55d332c1efb) - Clone raw options [`1c4cefc`](https://togithub.com/sindresorhus/got/commit/1c4cefc9b49f891712c3758f853d8c6214a1c904) - Fix invalid `afterResponse` return check [`cbc8902`](https://togithub.com/sindresorhus/got/commit/cbc8902) - Fix `https.alpnProtocols` not having an effect [`e1099fb`](https://togithub.com/sindresorhus/got/commit/e1099fb) ##### Improvements - Make the `context` option mergeable ([#​1459](https://togithub.com/sindresorhus/got/issues/1459)) [`2b8ed1f`](https://togithub.com/sindresorhus/got/commit/2b8ed1f5a185f30603d24e2ceb8181782de3bc5a) - Add generic argument to AfterResponseHook TypeScript type ([#​1589](https://togithub.com/sindresorhus/got/issues/1589)) [`6fc04a9`](https://togithub.com/sindresorhus/got/commit/6fc04a9b92f07b07b9fba010f2231a90082a039b) - Add read timeout ([#​1518](https://togithub.com/sindresorhus/got/issues/1518)) [`e943672`](https://togithub.com/sindresorhus/got/commit/e9436720fcb32b77d39d5477b420b18083e41c02) *(blocked by [https://github.com/nodejs/node/issues/35923](https://togithub.com/nodejs/node/issues/35923))* - Improve the pagination API ([#​1644](https://togithub.com/sindresorhus/got/issues/1644)) [`2675046`](https://togithub.com/sindresorhus/got/commit/2675046a83c7f03613f553a8da2912d491be900d) - Change the stackAllItems option to be false by default ([#​1645](https://togithub.com/sindresorhus/got/issues/1645)) [`1120370`](https://togithub.com/sindresorhus/got/commit/1120370e05fd8d9e768677d8474d0c82cf91a6a6) - Throw when afterResponse hook returns an invalid value [`4f21eb3`](https://togithub.com/sindresorhus/got/commit/4f21eb3db705c90797ef8ee1503704f78fea3c1b) - Add `retry.backoffLimit` option [`41c4136`](https://togithub.com/sindresorhus/got/commit/41c4136632b9391adb3ac53332b312089bc4dc16) - Add `noise` retry option [`e830077`](https://togithub.com/sindresorhus/got/commit/e83007704670b5f567ca338c156441f6c569ecb5) - Enable more HTTPS options [`83575d5`](https://togithub.com/sindresorhus/got/commit/83575d590a119027d319bd9208681973087564a9) [`fe723a0`](https://togithub.com/sindresorhus/got/commit/fe723a0477dc02785a0b477e3d5f85d0233e5b84) (thanks [@​Giotino](https://togithub.com/Giotino)) - Define `error.code` [`f27e8d3`](https://togithub.com/sindresorhus/got/commit/f27e8d331627074e76e4a9ec85a2c8d0a0625e5f) - Set `options.url` even if some options are invalid [`8d6a680`](https://togithub.com/sindresorhus/got/commit/8d6a6807883323a83ea5f126ca56b55d9ce5f299) - Improve memory usage when merging options [`2db5ec5`](https://togithub.com/sindresorhus/got/commit/2db5ec5d366efbbf9e0838eabfa6be774a0518a0) - Support async generators as body [`854430f`](https://togithub.com/sindresorhus/got/commit/854430f01350811fe8a0ccf20cd820aabfbd3926) [`3df52f3`](https://togithub.com/sindresorhus/got/commit/3df52f38edbadb45158c37d499817bc5486989c6) - Add missing `once` types for Stream API [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - New error type: `RetryError` which always triggers a new retry when thrown [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - `error.options` is now enumerable [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - `defaults.handlers` don't need a default handler now [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Add a parser for the `Link` header [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - General code improvements [`a5dd9aa`](https://togithub.com/sindresorhus/got/commit/a5dd9aa37e7891b2620798560799c7f8bd380877) ##### Breaking changes ##### Improved option normalization - Got exports an `Option` class that is specifically designed to parse and validate Got options. It is made of setters and getters that provide fast normalization and more consistent behavior. When passing an option does not exist, Got will throw an error. In order to retrieve the options before the error, use `error.options`. ```js import got from 'got'; try { await got('https://httpbin.org/anything', { thisOptionDoesNotExist: true }); } catch (error) { console.error(error); console.error(error.options.url.href); // Unexpected option: thisOptionDoesNotExist // https://httpbin.org/anything } ``` - The `init` hook now accepts a second argument: `self`, which points to an `Options` instance. In order to define your own options, you have to move them to `options.context` in an [`init` hook](https://togithub.com/sindresorhus/got/blob/main/documentation/lets-make-a-plugin.md#authorization) or store them in `options.context` directly. - The `init` hooks are ran only when passing an options object explicitly. ```diff - await got('https://example.com'); // this will *not* trigger the init hooks + await got('https://example.com', {}); // this *will** trigger init hooks ``` - [`options.merge()`](2-options.md) replaced `got.mergeOptions` and `Request.normalizeArguments` ```diff - got.defaults.options = got.mergeOptions(got.defaults.options, {…}); + got.defaults.options.merge(…); ``` This fixes issues like [#​1450](https://togithub.com/sindresorhus/got/issues/1450) - Legacy `Url` instances are not supported anymore. You need to use WHATWG URL instead. ```diff - await got(string, {port: 8443}); + const url = new URL(string); + url.port = 8443; + await got(url); ``` - No implicit timeout declaration. ```diff - await got('https://example.com', {timeout: 5000}) + await got('https://example.com', {timeout: {request: 5000}) ``` - No implicit retry declaration. ```diff - await got('https://example.com', {retry: 5}) + await got('https://example.com', {retry: {limit: 5}) ``` - `dnsLookupIpVersion` is now a number (4 or 6) or undefined ```diff - await got('https://example.com', {dnsLookupIpVersion: 'ipv4'}) + await got('https://example.com', {dnsLookupIpVersion: 4}) ``` - `redirectUrls` and `requestUrl` now give URL instances ```diff - request.requestUrl + request.requestUrl.origin + request.requestUrl.href + request.requestUrl.toString() ``` ```diff - request.redirectUrls[0] + request.redirectUrls[0].origin + request.redirectUrls[0].href + request.redirectUrls[0].toString() ``` - Renamed `request.aborted` to `request.isAborted` ```diff - request.aborted + request.isAborted ``` Reason: consistency with `options.isStream`. - Renamed the `lookup` option to `dnsLookup` ```diff - await got('https://example.com', {lookup: cacheable.lookup}) + await got('https://example.com', {dnsLookup: cacheable.lookup}) ``` - The `beforeRetry` hook now accepts only two arguments: `error` and `retryCount` ```diff await got('https://example.com', { hooks: { beforeRetry: [ - (options, error, retryCount) => { - console.log(options, error, retryCount); - } + (error, retryCount) => { + console.log(error.options, error, retryCount); + } ] } }) ``` The `options` argument has been removed, however it's still accessible via `error.options`. All modifications on `error.options` will be reflected in the next requests (no behavior change, same as with Got 11). - The `beforeRedirect` hook's first argument (options) is now a cloned instance of the Request options. This was done to make retrieving the original options possible: `plainResponse.request.options`. ```diff await got('http://szmarczak.com', { hooks: { beforeRedirect: [ (options, response) => { - console.log(options === response.request.options); //=> true [invalid! our original options were overriden] + console.log(options === response.request.options); //=> false [we can access the original options now] } ] } }) ``` - The `redirect` event now takes two arguments in this order: `updatedOptions` and `plainResponse`. ```diff - stream.on('redirect', (response, options) => …) + stream.on('redirect', (options, response) => …) ``` Reason: consistency with the `beforeRedirect` hook. - The `socketPath` option has been removed. Use the `unix:` protocol instead. ```diff - got('/containers/json', {socketPath: '/var/run/docker.sock'}) + got('unix:/var/run/docker.sock:/containers/json') + got('http://unix:/var/run/docker.sock:/containers/json') ``` - The `retryWithMergedOptions` function in an `afterResponse` hook no longer returns a `Promise`. It now throws `RetryError`, so this should this should be the last function being executed. This was done to allow `beforeRetry` hooks getting called. - You can no longer set `options.agent` to `false`. To do so, you need to define all the `options.agent` properties: `http`, `https` and `http2`. ```diff await got('https://example.com', { - agent: false + agent: { + http: false, + https: false, + http2: false + } }) ``` - When passing a `url` option when paginating, it now needs to be an absolute URL - the `prefixUrl` option is always reset from now on. The same when retrying in an `afterResponse` hook. ```diff - return {url: '/location'}; + return {url: new URL('/location', response.request.options.url)}; ``` There was confusion around the `prefixUrl` option. It was counterintuitive if used with the Pagination API. For example, it worked fine if the server replied with a relative URL, but if it was an absolute URL then the `prefixUrl` would end up duplicated. In order to fix this, Got now requires an absolute URL - no `prefixUrl` will be applied. - `got.extend(…)` will throw when passing some options that don't accept undefined - undefined no longer retains the old value, as setting undefined explicitly may reset the option ##### Documentation We have redesigned the documentation so it's easier to navigate and find exactly what you are looking for. We hope you like it ❤️ </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/X-oss-byte/Canary-nextjs).
kodiakhq bot
referenced
this issue
in X-oss-byte/Nextjs
Oct 12, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [got](https://togithub.com/sindresorhus/got) | [`10.7.0` -> `13.0.0`](https://renovatebot.com/diffs/npm/got/10.7.0/13.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/got/13.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/got/13.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/got/10.7.0/13.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/got/10.7.0/13.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>sindresorhus/got (got)</summary> ### [`v13.0.0`](https://togithub.com/sindresorhus/got/releases/tag/v13.0.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.6.1...v13.0.0) As a reminder, Got continues to require ESM. For TypeScript users, this includes having [`"module": "node16", "moduleResolution": "node16"` in your tsconfig](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-make-my-typescript-project-output-esm). ##### Breaking - Require Node.js 16 [`52a1063`](https://togithub.com/sindresorhus/got/commit/52a1063) - Change the [`enableUnixSockets`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#enableunixsockets) option to be `false` by default [`852c312`](https://togithub.com/sindresorhus/got/commit/852c312) - Most users don't need it. ##### Improvements - Allow specifying `undefined` for options ([#​2258](https://togithub.com/sindresorhus/got/issues/2258)) [`1cefe8b`](https://togithub.com/sindresorhus/got/commit/1cefe8b) ### [`v12.6.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.6.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.6.0...v12.6.1) - Fix `get-stream` import statement ([#​2266](https://togithub.com/sindresorhus/got/issues/2266)) [`67d5039`](https://togithub.com/sindresorhus/got/commit/67d5039) ### [`v12.6.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.6.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.3...v12.6.0) - Update dependencies [`88c88fb`](https://togithub.com/sindresorhus/got/commit/88c88fb) [`979272e`](https://togithub.com/sindresorhus/got/commit/979272e) - Loosen URL validation strictness ([#​2200](https://togithub.com/sindresorhus/got/issues/2200)) [`0ca0b7f`](https://togithub.com/sindresorhus/got/commit/0ca0b7f) ### [`v12.5.3`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.3) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.2...v12.5.3) - Fix abort event listeners not always being cleaned up ([#​2162](https://togithub.com/sindresorhus/got/issues/2162)) [`3cc40b5`](https://togithub.com/sindresorhus/got/commit/3cc40b5) ### [`v12.5.2`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.1...v12.5.2) - Improve TypeScript 4.9 compatibility ([#​2163](https://togithub.com/sindresorhus/got/issues/2163)) [`39f83b6`](https://togithub.com/sindresorhus/got/commit/39f83b6) ### [`v12.5.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.5.0...v12.5.1) - Fix compatibility with TypeScript and ESM [`3b3ea67`](https://togithub.com/sindresorhus/got/commit/3b3ea67) - Fix request body not being properly cached ([#​2150](https://togithub.com/sindresorhus/got/issues/2150)) [`3e9d3af`](https://togithub.com/sindresorhus/got/commit/3e9d3af) ### [`v12.5.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.5.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.4.1...v12.5.0) - Disable method rewriting on 307 and 308 status codes ([#​2145](https://togithub.com/sindresorhus/got/issues/2145)) [`e049e94`](https://togithub.com/sindresorhus/got/commit/e049e94) - Upgrade dependencies [`8630815`](https://togithub.com/sindresorhus/got/commit/8630815) [`f0ac0b3`](https://togithub.com/sindresorhus/got/commit/f0ac0b3) [`4c3762a`](https://togithub.com/sindresorhus/got/commit/4c3762a) ### [`v12.4.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.4.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.4.0...v12.4.1) ##### Fixes - Fix `options.context` being not extensible [`b671480`](https://togithub.com/sindresorhus/got/commit/b671480715dbbff908e9a385f5e714570c663cd7) - Don't emit `uploadProgress` after promise cancelation [`693de21`](https://togithub.com/sindresorhus/got/commit/693de217b030816f574d6e4cb505ee2e77b21c29) ### [`v12.4.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.4.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.3.1...v12.4.0) ##### Improvements - Support FormData without known length ([#​2120](https://togithub.com/sindresorhus/got/issues/2120)) [`850773c`](https://togithub.com/sindresorhus/got/commit/850773c) ##### Fixes - Don't call `beforeError` hooks with `HTTPError` if the `throwHttpErrors` option is `false` ([#​2104](https://togithub.com/sindresorhus/got/issues/2104)) [`3927348`](https://togithub.com/sindresorhus/got/commit/3927348) ### [`v12.3.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.3.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.3.0...v12.3.1) - Don't freeze signal when freezing Options ([#​2100](https://togithub.com/sindresorhus/got/issues/2100)) [`43b1467`](https://togithub.com/sindresorhus/got/commit/43b1467) ### [`v12.3.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.3.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.2.0...v12.3.0) - Add `.off()` method for events ([#​2092](https://togithub.com/sindresorhus/got/issues/2092)) [`88056be`](https://togithub.com/sindresorhus/got/commit/88056be) ### [`v12.2.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.2.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.1.0...v12.2.0) - [Support `AbortController`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#signal) ([#​2020](https://togithub.com/sindresorhus/got/issues/2020)) [`6a6d2a9`](https://togithub.com/sindresorhus/got/commit/6a6d2a9) - Add [`enableUnixSockets`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#enableunixsockets) option ([#​2062](https://togithub.com/sindresorhus/got/issues/2062)) [`461b3d4`](https://togithub.com/sindresorhus/got/commit/461b3d4) ### [`v12.1.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.1.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.4...v12.1.0) ##### Improvements - Add `response.ok` ([#​2043](https://togithub.com/sindresorhus/got/issues/2043)) [`22d58fb`](https://togithub.com/sindresorhus/got/commit/22d58fb) - This is only useful if you have [`{throwHttpErrors: false}`](https://togithub.com/sindresorhus/got/blob/main/documentation/2-options.md#throwhttperrors) ##### Fixes - Do not redirect to UNIX sockets ([#​2047](https://togithub.com/sindresorhus/got/issues/2047)) [`861ccd9`](https://togithub.com/sindresorhus/got/commit/861ccd9) - [CVE-2022-33987](https://nvd.nist.gov/vuln/detail/CVE-2022-33987) - [Also back ported to v11](https://togithub.com/sindresorhus/got/releases/tag/v11.8.5) ### [`v12.0.4`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.4) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.3...v12.0.4) - Remove stream lock - unreliable since Node 17.3.0 [`bb8eca9`](https://togithub.com/sindresorhus/got/commit/bb8eca924c338ca12d5b90d6a26aa28dbddb42ee) ### [`v12.0.3`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.3) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.2...v12.0.3) - Allow more types in the `json` option ([#​2015](https://togithub.com/sindresorhus/got/issues/2015)) [`eb045bf`](https://togithub.com/sindresorhus/got/commit/eb045bf) ### [`v12.0.2`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.1...v12.0.2) - Fix `encoding` option with `{responseType: 'json'}` ([#​1996](https://togithub.com/sindresorhus/got/issues/1996)) [`0703318`](https://togithub.com/sindresorhus/got/commit/0703318) ### [`v12.0.1`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v12.0.0...v12.0.1) - Fix `nock` compatibility ([#​1959](https://togithub.com/sindresorhus/got/issues/1959)) [`bf39d2c`](https://togithub.com/sindresorhus/got/commit/bf39d2c) - Fix missing export of `Request` TypeScript type ([#​1940](https://togithub.com/sindresorhus/got/issues/1940)) [`0f9f2b8`](https://togithub.com/sindresorhus/got/commit/0f9f2b8) ### [`v12.0.0`](https://togithub.com/sindresorhus/got/releases/tag/v12.0.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.8.6...v12.0.0) ##### Introducing Got v12.0.0 :tada: Long time no see! The latest Got version (v11.8.2) was released just in February ❄️ We have been working hard on squashing bugs and improving overall experience. If you find Got useful, you might want to [sponsor the Got maintainers](https://togithub.com/sindresorhus/got?sponsor=1). ##### This package is now pure ESM **Please [read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).** Also see [https://github.com/sindresorhus/got/issues/1789](https://togithub.com/sindresorhus/got/issues/1789). - **Please don't open issues about `[ERR_REQUIRE_ESM]` and `Must use import to load ES Module` errors.** This is a problem with your setup, not Got. - Please don't open issues about using Got with Jest. Jest does not fully support ESM. - Pretty much any problem with loading this package is a problem with your bundler, test framework, etc, not Got. - If you use TypeScript, you will want to stay on Got v11 until TypeScript 4.6 is out. [Why.](https://togithub.com/microsoft/TypeScript/issues/46452) - If you use a bundler, make sure it supports ESM and that you have correctly configured it for ESM. - The Got issue tracker is not a support channel for your favorite build/bundler tool. ##### Required Node.js >=14 While working with streams, we encountered more Node.js bugs that needed workarounds. In order to keep our code clean, we had to drop Node.js v12 as the code would get more messy. We strongly recommend that you update Node.js to **v14 LTS**. ##### HTTP/2 support Every Node.js release, the native `http2` module gets more stable. Unfortunately there are still some issues on the Node.js side, so we decided to keep HTTP/2 disabled for now. We may enable it by default in Got v13. It is still possible to turn it on via the `http2` option. To run HTTP/2 requests, it is required to use Node.js **v15.10** or above. ##### Bug fixes Woah, we possibly couldn't make a release if we didn't fix some bugs! - Do not throw on custom stack traces ([#​1491](https://togithub.com/sindresorhus/got/issues/1491)) [`49c16ee`](https://togithub.com/sindresorhus/got/commit/49c16ee54fb19ea7aa77e24ac8c2b602f0aad265) - Remove automatic `content-length` on ReadStream ([#​1510](https://togithub.com/sindresorhus/got/issues/1510)) [`472b8ef`](https://togithub.com/sindresorhus/got/commit/472b8ef9d9fc7713b740981a8b1103a7a9111b26) - Fix promise shortcuts in case of error status code ([#​1543](https://togithub.com/sindresorhus/got/issues/1543)) [`ff918fb`](https://togithub.com/sindresorhus/got/commit/ff918fb6dedb6d8b23421497ec890d43f45121b7) [`1107cc6`](https://togithub.com/sindresorhus/got/commit/1107cc625e4cc469276483316c48896a21f6251a) - Invert the `methodRewriting` option [`51d88a0`](https://togithub.com/sindresorhus/got/commit/51d88a0efed56760d116c5b911cea71e3265c787) - Fix `url` not being reused on retry in rare case ([#​1487](https://togithub.com/sindresorhus/got/issues/1487)) [`462bc63`](https://togithub.com/sindresorhus/got/commit/462bc630015064fa4ad4358cf28d24f95e1c958b) - Fix hanging promise on HTTP/2 timeout ([#​1492](https://togithub.com/sindresorhus/got/issues/1492)) [`a59fac4`](https://togithub.com/sindresorhus/got/commit/a59fac415ac013a48b1d514837628a5cf81d6878) - Prevent uncaught ParseErrors on initial successful response ([#​1527](https://togithub.com/sindresorhus/got/issues/1527)) [`77df9c3`](https://togithub.com/sindresorhus/got/commit/77df9c33db5ba3126f54317171e1cfcfceefc3d5) - Throw an error when retrying with consumed body ([#​1507](https://togithub.com/sindresorhus/got/issues/1507)) [`62305d7`](https://togithub.com/sindresorhus/got/commit/62305d77d3428b5c714d21b4bbee68cc75b5f787) - Fix a Node.js 16 bug that hangs Got streams [`06a2d3d`](https://togithub.com/sindresorhus/got/commit/06a2d3d7d8d4fcc6898b6364d1a18ca1d407092b) - Fix default pagination handling for empty Link header ([#​1768](https://togithub.com/sindresorhus/got/issues/1768)) [`1e1e506`](https://togithub.com/sindresorhus/got/commit/1e1e50647e93d038a4cc6a9bbbfbf61165d8fd39) - Fix incorrect `response.complete` when using cache [`9e15d88`](https://togithub.com/sindresorhus/got/commit/9e15d887da3b065940bbc8ca38f9c748a0bbc75e) - Fix `Cannot call end` error when `request` returns a `Writable` [`226cc39`](https://togithub.com/sindresorhus/got/commit/226cc3995f6e16938163ebde24d8762e7dcd15e2) - Fix Request options not being reused on retry [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Fix types being not compatible with CommonJS [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Fix `got.paginate does not call init hooks` ([#​1574](https://togithub.com/sindresorhus/got/issues/1574)) [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Generate a new object when passing options to the native `https` module ([#​1567](https://togithub.com/sindresorhus/got/issues/1567)) [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Remove stream reuse check ([#​1803](https://togithub.com/sindresorhus/got/issues/1803)) [`9ecc5ee`](https://togithub.com/sindresorhus/got/commit/9ecc5ee76f77aafd5100520d9d8789c491c8fb24) - Fix merging `searchParams` ([#​1814](https://togithub.com/sindresorhus/got/issues/1814)) [`1018c20`](https://togithub.com/sindresorhus/got/commit/1018c2029eea1f5b75b5120265996f1c0b3c12ae) [`732e9bd`](https://togithub.com/sindresorhus/got/commit/732e9bd9406ba1c3dd64b445264e891f33fc0254) - Fix unhandled exception when lookup returns invalid IP early ([#​1737](https://togithub.com/sindresorhus/got/issues/1737)) [`2453e5e`](https://togithub.com/sindresorhus/got/commit/2453e5e4213fe036a0108de3e4db414dcf2b4c30) - Fix relative URLs when paginating [`439fb82`](https://togithub.com/sindresorhus/got/commit/439fb82d2a07cece417a18c47e37cfdeaaf38db7) - Require url to be an instance of URL when paginating ([#​1818](https://togithub.com/sindresorhus/got/issues/1818)) [`eda69ff`](https://togithub.com/sindresorhus/got/commit/eda69ff924a621e499d31cbc590993a32ddb48d3) - Fix `username` and `password` encoding in URL ([#​1169](https://togithub.com/sindresorhus/got/issues/1169) [#​1317](https://togithub.com/sindresorhus/got/issues/1317)) [`d65d0ca`](https://togithub.com/sindresorhus/got/commit/d65d0caf627e8d1f5367db34d7d9b55d332c1efb) - Clone raw options [`1c4cefc`](https://togithub.com/sindresorhus/got/commit/1c4cefc9b49f891712c3758f853d8c6214a1c904) - Fix invalid `afterResponse` return check [`cbc8902`](https://togithub.com/sindresorhus/got/commit/cbc8902) - Fix `https.alpnProtocols` not having an effect [`e1099fb`](https://togithub.com/sindresorhus/got/commit/e1099fb) ##### Improvements - Make the `context` option mergeable ([#​1459](https://togithub.com/sindresorhus/got/issues/1459)) [`2b8ed1f`](https://togithub.com/sindresorhus/got/commit/2b8ed1f5a185f30603d24e2ceb8181782de3bc5a) - Add generic argument to AfterResponseHook TypeScript type ([#​1589](https://togithub.com/sindresorhus/got/issues/1589)) [`6fc04a9`](https://togithub.com/sindresorhus/got/commit/6fc04a9b92f07b07b9fba010f2231a90082a039b) - Add read timeout ([#​1518](https://togithub.com/sindresorhus/got/issues/1518)) [`e943672`](https://togithub.com/sindresorhus/got/commit/e9436720fcb32b77d39d5477b420b18083e41c02) *(blocked by [https://github.com/nodejs/node/issues/35923](https://togithub.com/nodejs/node/issues/35923))* - Improve the pagination API ([#​1644](https://togithub.com/sindresorhus/got/issues/1644)) [`2675046`](https://togithub.com/sindresorhus/got/commit/2675046a83c7f03613f553a8da2912d491be900d) - Change the stackAllItems option to be false by default ([#​1645](https://togithub.com/sindresorhus/got/issues/1645)) [`1120370`](https://togithub.com/sindresorhus/got/commit/1120370e05fd8d9e768677d8474d0c82cf91a6a6) - Throw when afterResponse hook returns an invalid value [`4f21eb3`](https://togithub.com/sindresorhus/got/commit/4f21eb3db705c90797ef8ee1503704f78fea3c1b) - Add `retry.backoffLimit` option [`41c4136`](https://togithub.com/sindresorhus/got/commit/41c4136632b9391adb3ac53332b312089bc4dc16) - Add `noise` retry option [`e830077`](https://togithub.com/sindresorhus/got/commit/e83007704670b5f567ca338c156441f6c569ecb5) - Enable more HTTPS options [`83575d5`](https://togithub.com/sindresorhus/got/commit/83575d590a119027d319bd9208681973087564a9) [`fe723a0`](https://togithub.com/sindresorhus/got/commit/fe723a0477dc02785a0b477e3d5f85d0233e5b84) (thanks [@​Giotino](https://togithub.com/Giotino)) - Define `error.code` [`f27e8d3`](https://togithub.com/sindresorhus/got/commit/f27e8d331627074e76e4a9ec85a2c8d0a0625e5f) - Set `options.url` even if some options are invalid [`8d6a680`](https://togithub.com/sindresorhus/got/commit/8d6a6807883323a83ea5f126ca56b55d9ce5f299) - Improve memory usage when merging options [`2db5ec5`](https://togithub.com/sindresorhus/got/commit/2db5ec5d366efbbf9e0838eabfa6be774a0518a0) - Support async generators as body [`854430f`](https://togithub.com/sindresorhus/got/commit/854430f01350811fe8a0ccf20cd820aabfbd3926) [`3df52f3`](https://togithub.com/sindresorhus/got/commit/3df52f38edbadb45158c37d499817bc5486989c6) - Add missing `once` types for Stream API [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - New error type: `RetryError` which always triggers a new retry when thrown [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - `error.options` is now enumerable [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - `defaults.handlers` don't need a default handler now [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - Add a parser for the `Link` header [`3c23eea`](https://togithub.com/sindresorhus/got/commit/3c23eea5a096f6f8ea0edf3e2a27e1caca88acf9) - General code improvements [`a5dd9aa`](https://togithub.com/sindresorhus/got/commit/a5dd9aa37e7891b2620798560799c7f8bd380877) ##### Breaking changes ##### Improved option normalization - Got exports an `Option` class that is specifically designed to parse and validate Got options. It is made of setters and getters that provide fast normalization and more consistent behavior. When passing an option does not exist, Got will throw an error. In order to retrieve the options before the error, use `error.options`. ```js import got from 'got'; try { await got('https://httpbin.org/anything', { thisOptionDoesNotExist: true }); } catch (error) { console.error(error); console.error(error.options.url.href); // Unexpected option: thisOptionDoesNotExist // https://httpbin.org/anything } ``` - The `init` hook now accepts a second argument: `self`, which points to an `Options` instance. In order to define your own options, you have to move them to `options.context` in an [`init` hook](https://togithub.com/sindresorhus/got/blob/main/documentation/lets-make-a-plugin.md#authorization) or store them in `options.context` directly. - The `init` hooks are ran only when passing an options object explicitly. ```diff - await got('https://example.com'); // this will *not* trigger the init hooks + await got('https://example.com', {}); // this *will** trigger init hooks ``` - [`options.merge()`](2-options.md) replaced `got.mergeOptions` and `Request.normalizeArguments` ```diff - got.defaults.options = got.mergeOptions(got.defaults.options, {…}); + got.defaults.options.merge(…); ``` This fixes issues like [#​1450](https://togithub.com/sindresorhus/got/issues/1450) - Legacy `Url` instances are not supported anymore. You need to use WHATWG URL instead. ```diff - await got(string, {port: 8443}); + const url = new URL(string); + url.port = 8443; + await got(url); ``` - No implicit timeout declaration. ```diff - await got('https://example.com', {timeout: 5000}) + await got('https://example.com', {timeout: {request: 5000}) ``` - No implicit retry declaration. ```diff - await got('https://example.com', {retry: 5}) + await got('https://example.com', {retry: {limit: 5}) ``` - `dnsLookupIpVersion` is now a number (4 or 6) or undefined ```diff - await got('https://example.com', {dnsLookupIpVersion: 'ipv4'}) + await got('https://example.com', {dnsLookupIpVersion: 4}) ``` - `redirectUrls` and `requestUrl` now give URL instances ```diff - request.requestUrl + request.requestUrl.origin + request.requestUrl.href + request.requestUrl.toString() ``` ```diff - request.redirectUrls[0] + request.redirectUrls[0].origin + request.redirectUrls[0].href + request.redirectUrls[0].toString() ``` - Renamed `request.aborted` to `request.isAborted` ```diff - request.aborted + request.isAborted ``` Reason: consistency with `options.isStream`. - Renamed the `lookup` option to `dnsLookup` ```diff - await got('https://example.com', {lookup: cacheable.lookup}) + await got('https://example.com', {dnsLookup: cacheable.lookup}) ``` - The `beforeRetry` hook now accepts only two arguments: `error` and `retryCount` ```diff await got('https://example.com', { hooks: { beforeRetry: [ - (options, error, retryCount) => { - console.log(options, error, retryCount); - } + (error, retryCount) => { + console.log(error.options, error, retryCount); + } ] } }) ``` The `options` argument has been removed, however it's still accessible via `error.options`. All modifications on `error.options` will be reflected in the next requests (no behavior change, same as with Got 11). - The `beforeRedirect` hook's first argument (options) is now a cloned instance of the Request options. This was done to make retrieving the original options possible: `plainResponse.request.options`. ```diff await got('http://szmarczak.com', { hooks: { beforeRedirect: [ (options, response) => { - console.log(options === response.request.options); //=> true [invalid! our original options were overriden] + console.log(options === response.request.options); //=> false [we can access the original options now] } ] } }) ``` - The `redirect` event now takes two arguments in this order: `updatedOptions` and `plainResponse`. ```diff - stream.on('redirect', (response, options) => …) + stream.on('redirect', (options, response) => …) ``` Reason: consistency with the `beforeRedirect` hook. - The `socketPath` option has been removed. Use the `unix:` protocol instead. ```diff - got('/containers/json', {socketPath: '/var/run/docker.sock'}) + got('unix:/var/run/docker.sock:/containers/json') + got('http://unix:/var/run/docker.sock:/containers/json') ``` - The `retryWithMergedOptions` function in an `afterResponse` hook no longer returns a `Promise`. It now throws `RetryError`, so this should this should be the last function being executed. This was done to allow `beforeRetry` hooks getting called. - You can no longer set `options.agent` to `false`. To do so, you need to define all the `options.agent` properties: `http`, `https` and `http2`. ```diff await got('https://example.com', { - agent: false + agent: { + http: false, + https: false, + http2: false + } }) ``` - When passing a `url` option when paginating, it now needs to be an absolute URL - the `prefixUrl` option is always reset from now on. The same when retrying in an `afterResponse` hook. ```diff - return {url: '/location'}; + return {url: new URL('/location', response.request.options.url)}; ``` There was confusion around the `prefixUrl` option. It was counterintuitive if used with the Pagination API. For example, it worked fine if the server replied with a relative URL, but if it was an absolute URL then the `prefixUrl` would end up duplicated. In order to fix this, Got now requires an absolute URL - no `prefixUrl` will be applied. - `got.extend(…)` will throw when passing some options that don't accept undefined - undefined no longer retains the old value, as setting undefined explicitly may reset the option ##### Documentation We have redesigned the documentation so it's easier to navigate and find exactly what you are looking for. We hope you like it :heart: ### [`v11.8.6`](https://togithub.com/sindresorhus/got/releases/tag/v11.8.6) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.8.5...v11.8.6) - Destroy request object after successful response ### [`v11.8.5`](https://togithub.com/sindresorhus/got/releases/tag/v11.8.5) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.8.3...v11.8.5) - Backport security fix https://github.com/sindresorhus/got/commit/861ccd9ac2237df762a9e2beed7edd88c60782dc - [CVE-2022-33987](https://nvd.nist.gov/vuln/detail/CVE-2022-33987) ### [`v11.8.3`](https://togithub.com/sindresorhus/got/releases/tag/v11.8.3) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.8.2...v11.8.3) - Bump cacheable-request dependency ([#​1921](https://togithub.com/sindresorhus/got/issues/1921)) [`9463bb6`](https://togithub.com/sindresorhus/got/commit/9463bb6) - Fix `HTTPError` missing `.code` property ([#​1739](https://togithub.com/sindresorhus/got/issues/1739)) [`0e167b8`](https://togithub.com/sindresorhus/got/commit/0e167b8) ### [`v11.8.2`](https://togithub.com/sindresorhus/got/releases/tag/v11.8.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.8.1...v11.8.2) - Make the `dnsCache` option lazy ([#​1529](https://togithub.com/sindresorhus/got/issues/1529)) [`3bd245f`](https://togithub.com/sindresorhus/got/commit/3bd245f) This slightly improves Got startup performance and fixes an issue with Jest. ### [`v11.8.1`](https://togithub.com/sindresorhus/got/releases/tag/v11.8.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.8.0...v11.8.1) - Do not throw on custom stack traces ([#​1491](https://togithub.com/sindresorhus/got/issues/1491)) [`4c815c3`](https://togithub.com/sindresorhus/got/commit/4c815c3a609eb74d0eb139414d9996b4f65dc3c0) ### [`v11.8.0`](https://togithub.com/sindresorhus/got/releases/tag/v11.8.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.7.0...v11.8.0) - Fix for sending files with size `0` on `stat` ([#​1488](https://togithub.com/sindresorhus/got/issues/1488)) [`7acd380`](https://togithub.com/sindresorhus/got/commit/7acd380) - `beforeRetry` allows stream body if different from original ([#​1501](https://togithub.com/sindresorhus/got/issues/1501)) [`3dd2273`](https://togithub.com/sindresorhus/got/commit/3dd2273) - Set default value for an options object ([#​1495](https://togithub.com/sindresorhus/got/issues/1495)) [`390b145`](https://togithub.com/sindresorhus/got/commit/390b145) ### [`v11.7.0`](https://togithub.com/sindresorhus/got/releases/tag/v11.7.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.6.2...v11.7.0) ##### Improvements - Add [`pfx`](https://togithub.com/sindresorhus/got#httpspfx) HTTPS option ([#​1364](https://togithub.com/sindresorhus/got/issues/1364)) [`c33df7f`](https://togithub.com/sindresorhus/got/commit/c33df7f) - Update `body` after `beforeRequest` ([#​1453](https://togithub.com/sindresorhus/got/issues/1453)) [`e1c1844`](https://togithub.com/sindresorhus/got/commit/e1c1844) - Don't allocate buffer twice ([#​1403](https://togithub.com/sindresorhus/got/issues/1403)) [`7bc69d9`](https://togithub.com/sindresorhus/got/commit/7bc69d9) ##### Fixes - Fix a regression where body was sent after redirect [`88b32ea`](https://togithub.com/sindresorhus/got/commit/88b32ea) - Fix destructure error on `promise.json()` [`c97ce7c`](https://togithub.com/sindresorhus/got/commit/c97ce7c) - Do not ignore userinfo on a redirect to the same origin [`52de13b`](https://togithub.com/sindresorhus/got/commit/52de13b) ### [`v11.6.2`](https://togithub.com/sindresorhus/got/releases/tag/v11.6.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.6.1...v11.6.2) ##### Bug fixes - Inherit the `prefixUrl` option from parent if it's `undefined` ([#​1448](https://togithub.com/sindresorhus/got/issues/1448)) [`a3da70a`](https://togithub.com/sindresorhus/got/commit/a3da70a78aeb7f44dd3e0d0fa47cebe9541eb91e) - Prepare a fix for hanging promise on Node.js 14.10.x [`29d4e32`](https://togithub.com/sindresorhus/got/commit/29d4e325b110ccf7571d4265d40760be4175f7ff) - Prepare for Node.js 15.0.0 [`c126ff1`](https://togithub.com/sindresorhus/got/commit/c126ff19c4e893975cbf6c2c8bebce6ed7631276) ##### Docs - Point travis-ci.org badge to travis-ci.com ([#​1442](https://togithub.com/sindresorhus/got/issues/1442)) [`2b352d3`](https://togithub.com/sindresorhus/got/commit/2b352d3f9e216e116efc0249a3a78b8d4492f97c) - Clarify the retry mechanism [`f248618`](https://togithub.com/sindresorhus/got/commit/f2486180207dba30624901761a457694096441c1) - Fix `RequestError` links [`3ed4af6`](https://togithub.com/sindresorhus/got/commit/3ed4af605ca6493c080cc8003a55c3b37988efee) ##### Tests - Downgrade Travis CI Node.js version to 14.9.0 ([#​1454](https://togithub.com/sindresorhus/got/issues/1454)) [`27470b5`](https://togithub.com/sindresorhus/got/commit/27470b53e1bcd6f435fc77006c9e3e864961dbec) ### [`v11.6.1`](https://togithub.com/sindresorhus/got/releases/tag/v11.6.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.6.0...v11.6.1) ##### Fixes - Fix `options.port` on redirect ([#​1439](https://togithub.com/sindresorhus/got/issues/1439)) [`408e22a`](https://togithub.com/sindresorhus/got/commit/408e22a) ##### Meta - Welcome [@​Giotino](https://togithub.com/Giotino) as a maintainer 🎉 [`5031843`](https://togithub.com/sindresorhus/got/commit/5031843) - Showcase companies using Got ([#​1432](https://togithub.com/sindresorhus/got/issues/1432)) [`d12d6af`](https://togithub.com/sindresorhus/got/commit/d12d6af) ### [`v11.6.0`](https://togithub.com/sindresorhus/got/releases/tag/v11.6.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.5.2...v11.6.0) ##### Improvements - Add `retry` stream event ([#​1384](https://togithub.com/sindresorhus/got/issues/1384)) [`7072198`](https://togithub.com/sindresorhus/got/commit/707219825b2f8ff3df597230a53244636df21642) - Add types for `http-cache-semantics` options [`2e2295f`](https://togithub.com/sindresorhus/got/commit/2e2295fba63c260d347fef2081cdbcae45fa6116) - Make `CancelError` inherit `RequestError` [`1f132e8`](https://togithub.com/sindresorhus/got/commit/1f132e88b4e9b295631637757d64307032a4e56e) - Add `retryAfter` to `RetryObject` [`643a305`](https://togithub.com/sindresorhus/got/commit/643a305b4d710042d2a958a21e7637183713505c) - Add documentation comments to exported TypeScript types ([#​1278](https://togithub.com/sindresorhus/got/issues/1278)) [`eaf1e02`](https://togithub.com/sindresorhus/got/commit/eaf1e02b21e4b8c08197c6400844d4098828ecf4) - Move cache options into a `cacheOptions` property [`9c16d90`](https://togithub.com/sindresorhus/got/commit/9c16d9083019fcb28f566659106036faa4839447) ##### Bug fixes - Got promise shouldn't retry when the body is a stream [`6e1aeae`](https://togithub.com/sindresorhus/got/commit/6e1aeaedb5dfe4f4b15eecf72a80303c30df22af) ##### Docs - Add an example of nock integration with retrying [`f7bbc37`](https://togithub.com/sindresorhus/got/commit/f7bbc3753779e14b22d7aa337764c7048aebb915) - Fix `CancelError` docs [`28c400f`](https://togithub.com/sindresorhus/got/commit/28c400f4df5f45990f80641a794a2d09439bef93) - Fix retry delay function in the `README` ([#​1425](https://togithub.com/sindresorhus/got/issues/1425)) [`38bbb04`](https://togithub.com/sindresorhus/got/commit/38bbb04ea24f01eed6f01e394bc3e9405df8cfc5) ### [`v11.5.2`](https://togithub.com/sindresorhus/got/releases/tag/v11.5.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.5.1...v11.5.2) ##### Docs - Add hpagent to proxy section ([#​1363](https://togithub.com/sindresorhus/got/issues/1363)) [`a3e171c`](https://togithub.com/sindresorhus/got/commit/a3e171c4d43c8bbb236ef3a04feb25ba6fdf6c49) - Mention header lowercasing in`request` migration guide ([#​1387](https://togithub.com/sindresorhus/got/issues/1387)) [`a748343`](https://togithub.com/sindresorhus/got/commit/a748343363ecb0347897264fb49df4a8f4793997) - Fixed deprecationWarning on https options ([#​1391](https://togithub.com/sindresorhus/got/issues/1391)) [`9a309bd`](https://togithub.com/sindresorhus/got/commit/9a309bdbe7e2552c5bffbea253d58c39d6e6c3e3) ##### Bug fixes - Fix duplicated hooks when paginating [`e02845f`](https://togithub.com/sindresorhus/got/commit/e02845f1aa737d55dce23381d0f4f2a61b1eb5e1) - Fix `dnsCache: true` having no effect [`043c950`](https://togithub.com/sindresorhus/got/commit/043c9501b85172e09819d44ac8eb49c574b27bda) ### [`v11.5.1`](https://togithub.com/sindresorhus/got/releases/tag/v11.5.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.5.0...v11.5.1) ##### Enhancements - Upgrade `http2-wrapper` to `1.0.0-beta.5.0` [`16e7f03`](https://togithub.com/sindresorhus/got/commit/16e7f031bb371571e1948091b88385be3485d83f) - Compatibility fix to ignore incorrect Node.js 12 typings [`f7a1379`](https://togithub.com/sindresorhus/got/commit/f7a1379e417641613bf1b654e37f37a7e6447e0c) [`61d6f61`](https://togithub.com/sindresorhus/got/commit/61d6f610ffa6b760d466ff910a8e959778ee36e0) ##### Bug fixes - Prevent uncaught errors on HTTP errors [`2d96679`](https://togithub.com/sindresorhus/got/commit/2d96679c0a007be657835e83c6afb20b4510e9c5) [`1ef053d`](https://togithub.com/sindresorhus/got/commit/1ef053d2af7f9b050ce0a3d1884f45b285f2e775) ##### Docs - Mention HTTP/2 proxying in `readme.md` [`4ebd26a`](https://togithub.com/sindresorhus/got/commit/4ebd26a4b8eef704fe216d333e2614b39dedf695) - Update the comparison table [`bd2d532`](https://togithub.com/sindresorhus/got/commit/bd2d53269882e48af88ff736a2e82aecd9e1fbee) [`c833939`](https://togithub.com/sindresorhus/got/commit/c83393933c2b308a312ed4dc85d852c79445e400) - Document the hierarchy of error classes ([#​1359](https://togithub.com/sindresorhus/got/issues/1359)) [`559526e`](https://togithub.com/sindresorhus/got/commit/559526ee273fb60d152759d288bc76971abb99e2) - Fix example code for HTTPS proxy ([#​1360](https://togithub.com/sindresorhus/got/issues/1360)) [`4083347`](https://togithub.com/sindresorhus/got/commit/408334756ace0570ca4a0aded5a8aeac437eac33) ### [`v11.5.0`](https://togithub.com/sindresorhus/got/releases/tag/v11.5.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.4.0...v11.5.0) ##### Improvements - Add `backoff` option to pagination ([#​1182](https://togithub.com/sindresorhus/got/issues/1182)) [`4be7446`](https://togithub.com/sindresorhus/got/commit/4be7446) - Upgrade dependencies ([#​1345](https://togithub.com/sindresorhus/got/issues/1345)) [`b9a855d`](https://togithub.com/sindresorhus/got/commit/b9a855d) [`476c026`](https://togithub.com/sindresorhus/got/commit/476c026) [`8d697bc`](https://togithub.com/sindresorhus/got/commit/8d697bc) - Upgrade to TypeScript 3.9 ([#​1267](https://togithub.com/sindresorhus/got/issues/1267)) [`b51d836`](https://togithub.com/sindresorhus/got/commit/b51d836) ##### Fixes - Fix TypeScript types for Promise API ([#​1344](https://togithub.com/sindresorhus/got/issues/1344)) [`676be6d`](https://togithub.com/sindresorhus/got/commit/676be6d) - Fix cache not working with HTTP2 [`ac5f67d`](https://togithub.com/sindresorhus/got/commit/ac5f67d) - Fix `response` event not being emitted on cache verify request ([#​1305](https://togithub.com/sindresorhus/got/issues/1305)) [`da4769e`](https://togithub.com/sindresorhus/got/commit/da4769e) - Work around a bug in Node.js <=12.18.2 [`f33e8bc`](https://togithub.com/sindresorhus/got/commit/f33e8bc) - Remove request error handler after response is downloaded [`e1afe82`](https://togithub.com/sindresorhus/got/commit/e1afe82) - Revert "Remove request error handler after response is downloaded" [`aeb2e07`](https://togithub.com/sindresorhus/got/commit/aeb2e07) ##### Docs - Mention advanced usage of a `beforeRequest` hook [`779062a`](https://togithub.com/sindresorhus/got/commit/779062a) - Mention to end the stream if there's no body [`044767e`](https://togithub.com/sindresorhus/got/commit/044767e) ### [`v11.4.0`](https://togithub.com/sindresorhus/got/releases/tag/v11.4.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.3.0...v11.4.0) - Fix hanging promise on timeout on HTTP error [`934211f`](https://togithub.com/sindresorhus/got/commit/934211f951bfd56751e90ec4eabe6379d8541a05) - Use async iterators to get response body ([#​1256](https://togithub.com/sindresorhus/got/issues/1256)) [`7dcd145`](https://togithub.com/sindresorhus/got/commit/7dcd1456a68a2603d30cbb1a4e453c4560bd51b2) - Fix promise not returning Buffer on compressed response [`5028c11`](https://togithub.com/sindresorhus/got/commit/5028c11abd21c9d13bb3b12abb02961ec0465a8a) - Clarify options.encoding docs [`04f3ea4`](https://togithub.com/sindresorhus/got/commit/04f3ea4b7995e1609555dd13f00641b8f470de4c) - Fix unhandled `The server aborted pending request` rejection [`728aef9`](https://togithub.com/sindresorhus/got/commit/728aef989c1a6650d2b42a7f69b603075b5d35bf) - Add missing `ECONNRESET` code to an abort error [`d325d35`](https://togithub.com/sindresorhus/got/commit/d325d353a28e6038140aa5b18f2b6f9f796f10b6) - Fix `prefixUrl` not working when the `url` argument is empty [`8d3412a`](https://togithub.com/sindresorhus/got/commit/8d3412abb8aae3cefc75dd6f9e698988ed463dd6) - Improve the `searchParams` option [`4dbada9`](https://togithub.com/sindresorhus/got/commit/4dbada94e261ad890d2478c313ec3d74761b659e) - Fix non-enumerable options \[such as body] not being used [`8f775c7`](https://togithub.com/sindresorhus/got/commit/8f775c71c41a377186c6b38c6789542bfd523039) ### [`v11.3.0`](https://togithub.com/sindresorhus/got/releases/tag/v11.3.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.2.0...v11.3.0) - Deep merge `https` options ([#​1304](https://togithub.com/sindresorhus/got/issues/1304)) [`c98f0d7`](https://togithub.com/sindresorhus/got/commit/c98f0d7) - Add options to customize [parsing/stringifying JSON](https://togithub.com/sindresorhus/got#parsejson) ([#​1298](https://togithub.com/sindresorhus/got/issues/1298)) [`cb4da8d`](https://togithub.com/sindresorhus/got/commit/cb4da8d) - Add [`dnsLookupIpVersion`](https://togithub.com/sindresorhus/got#dnslookupipversion) option ([#​1264](https://togithub.com/sindresorhus/got/issues/1264)) [`7f643bb`](https://togithub.com/sindresorhus/got/commit/7f643bb) ### [`v11.2.0`](https://togithub.com/sindresorhus/got/releases/tag/v11.2.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.1.4...v11.2.0) - Provide an overload for unknown `responseType` ([#​1276](https://togithub.com/sindresorhus/got/issues/1276)) [`b9ba18a`](https://togithub.com/sindresorhus/got/commit/b9ba18a) - Fix overriding some options in a `beforeRequest` hook ([#​1293](https://togithub.com/sindresorhus/got/issues/1293)) [`d8c00cf`](https://togithub.com/sindresorhus/got/commit/d8c00cf) - Fix hanging promise on aborted requests on Node v14.3.0 ([#​1296](https://togithub.com/sindresorhus/got/issues/1296)) [`2ccc4c2`](https://togithub.com/sindresorhus/got/commit/2ccc4c2) - Do not wait for `ready` event if the file descriptor is already opened ([#​1289](https://togithub.com/sindresorhus/got/issues/1289)) [`2c8fe19`](https://togithub.com/sindresorhus/got/commit/2c8fe19) - General improvements to HTTPS API ([#​1255](https://togithub.com/sindresorhus/got/issues/1255)) [`697de37`](https://togithub.com/sindresorhus/got/commit/697de37) ### [`v11.1.4`](https://togithub.com/sindresorhus/got/releases/tag/v11.1.4) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.1.3...v11.1.4) - Clarify docs for got.HTTPError ([#​1244](https://togithub.com/sindresorhus/got/issues/1244)) [`3f125f1`](https://togithub.com/sindresorhus/got/commit/3f125f105e3b328942c04ef73579b1573fc39b5a) - Upgrade `cacheable-lookup` to 5.0.3 [`9770e54`](https://togithub.com/sindresorhus/got/commit/9770e540d088c35ec0b467fa3d2fafb60ed6797d) - Add a Runkit example ([#​1253](https://togithub.com/sindresorhus/got/issues/1253)) [`48bbb36`](https://togithub.com/sindresorhus/got/commit/48bbb369d715b8ec3c36e0af1ec88f47e2299172) - Mention `options.rejectUnauthorized` in the documentation [`9b04963`](https://togithub.com/sindresorhus/got/commit/9b049635570ebbdd9d534ad1860f01d34771a5ee) - Test `responseType` set to `undefined` [`0e8582f`](https://togithub.com/sindresorhus/got/commit/0e8582f24e6903d9079a7d92e9b4d831cb5b5f17) - Slightly improve RunKit example [`6f84051`](https://togithub.com/sindresorhus/got/commit/6f8405102517a1e61393ee7bdb5a4fcff08e64c5) - Make `got.paginate()` an alias for `got.paginate.each()` [`5480b31`](https://togithub.com/sindresorhus/got/commit/5480b3134cfd35497f618f08f574927c2bd7624b) - Don't force query string normalization ([#​1246](https://togithub.com/sindresorhus/got/issues/1246)) [`761b8e0`](https://togithub.com/sindresorhus/got/commit/761b8e01f7d194dd3b9aa6578c26966ebae6172c) - Upgrade `decompress-response` to `6.0.0` [`c2bc014`](https://togithub.com/sindresorhus/got/commit/c2bc014abc8818ad93dd69a0e8cc9d36d0dccb9c) - Migrate from `lolex` to `@sinonjs/fake-timers` ([#​1270](https://togithub.com/sindresorhus/got/issues/1270)) [`df333dd`](https://togithub.com/sindresorhus/got/commit/df333ddbc163e35537a9f49818e722c7aa6803c0) - Make `calculateDelay` promisable ([#​1266](https://togithub.com/sindresorhus/got/issues/1266)) [`3745efc`](https://togithub.com/sindresorhus/got/commit/3745efc9d9d03c78c898f357a34524524cce514d) ### [`v11.1.3`](https://togithub.com/sindresorhus/got/releases/tag/v11.1.3) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.1.2...v11.1.3) - Do not use deprecated `request.abort()` ([#​1242](https://togithub.com/sindresorhus/got/issues/1242)) [`ab338a7`](https://togithub.com/sindresorhus/got/commit/ab338a70dd9547a6c48af18ab5e2306639e5cbad) - Remove the `host` header on redirect ([#​1241](https://togithub.com/sindresorhus/got/issues/1241)) [`8ff71d9`](https://togithub.com/sindresorhus/got/commit/8ff71d972ae55700887b45d50a265e3659ac8cce) - Prevent URL pollution ([#​1243](https://togithub.com/sindresorhus/got/issues/1243)) [`7dbb9ee`](https://togithub.com/sindresorhus/got/commit/7dbb9ee2bd58e8ee67ebfe734e0c62e765759593) - Fix duplicated searchParams for pagination API ([#​1229](https://togithub.com/sindresorhus/got/issues/1229)) [`91aa0ac`](https://togithub.com/sindresorhus/got/commit/91aa0ac9e676130cd4cfc1183d16208c6167b31d) - Add a test for stringified `searchParams` in merge ([#​1208](https://togithub.com/sindresorhus/got/issues/1208)) [`7d7361c`](https://togithub.com/sindresorhus/got/commit/7d7361cc3845421f24288fc39464a8b38bd75d56) - Fix reusing options when paginating [`8862270`](https://togithub.com/sindresorhus/got/commit/88622701c70434ddc1040c46ad16de0c0acd9143) - Fix an invalid pagination test [`47c1afe`](https://togithub.com/sindresorhus/got/commit/47c1afedc77b27a2eb3edd85064d8532da835045) [`5131dc2`](https://togithub.com/sindresorhus/got/commit/5131dc2778a9b584acda062635a9458d5b22df0c) ### [`v11.1.2`](https://togithub.com/sindresorhus/got/releases/tag/v11.1.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.1.1...v11.1.2) ##### Bug fixes - Disable `options.dnsCache` by default [`79507c2`](https://togithub.com/sindresorhus/got/commit/79507c2cdec137e65d715f36d13a5a0e577ddc01) > This should stay disabled when making requests to internal hostnames such as localhost, database.local etc. > CacheableLookup uses dns.resolver4(..) and dns.resolver6(...) under the hood and fall backs to dns.lookup(...) when the first two fail, which may lead to additional delay. ##### Enhancements - Add test cases for issues [#​1221](https://togithub.com/sindresorhus/got/issues/1221) and [#​1223](https://togithub.com/sindresorhus/got/issues/1223) ([#​1231](https://togithub.com/sindresorhus/got/issues/1231)) [`822bfa7`](https://togithub.com/sindresorhus/got/commit/822bfa770306737a3ad06196101975b669b5d738) - Update dependencies [`05ff878`](https://togithub.com/sindresorhus/got/commit/05ff8780768d48fb58c782ba0b9c141af44a7c15) ### [`v11.1.1`](https://togithub.com/sindresorhus/got/releases/tag/v11.1.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.1.0...v11.1.1) - Improve Node.js 14 compatibility [`50ef99a`](https://togithub.com/sindresorhus/got/commit/50ef99a) - Fix `got.mergeOptions()` regression [`157e02b`](https://togithub.com/sindresorhus/got/commit/157e02b) - Fix hanging promise when using cache [`7b19e8f`](https://togithub.com/sindresorhus/got/commit/7b19e8f) - Make `options.responseType` optional when using a template [`9ed0a39`](https://togithub.com/sindresorhus/got/commit/9ed0a39) ### [`v11.1.0`](https://togithub.com/sindresorhus/got/releases/tag/v11.1.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.0.3...v11.1.0) - Add [`pagination.stackAllItems`](https://togithub.com/sindresorhus/got#paginationstackallitems) option ([#​1214](https://togithub.com/sindresorhus/got/issues/1214)) [`c1208d1`](https://togithub.com/sindresorhus/got/commit/c1208d1) - Allow response body to be typed for pagination API ([#​1212](https://togithub.com/sindresorhus/got/issues/1212)) [`c127f5b`](https://togithub.com/sindresorhus/got/commit/c127f5b) - Fix some options not working with the pagination API [`278c421`](https://togithub.com/sindresorhus/got/commit/278c421) ### [`v11.0.3`](https://togithub.com/sindresorhus/got/releases/tag/v11.0.3) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.0.2...v11.0.3) ##### Fixes - Limit number of requests in pagination to prevent accidental overflows ([#​1181](https://togithub.com/sindresorhus/got/issues/1181)) [`4344c3a`](https://togithub.com/sindresorhus/got/commit/4344c3a) - Fix promise rejecting before retry [`b927e2d`](https://togithub.com/sindresorhus/got/commit/b927e2d) - Fix `options.searchParams` duplicates [`429db40`](https://togithub.com/sindresorhus/got/commit/429db40) - Prevent calling `.abort()` on a destroyed request [`63c1b72`](https://togithub.com/sindresorhus/got/commit/63c1b72) ##### Docs - Fix incorrect usage in the readme examples ([#​1203](https://togithub.com/sindresorhus/got/issues/1203)) [`16ff82f`](https://togithub.com/sindresorhus/got/commit/16ff82f) - Note that `cache` and `dnsCache` can be `false` [`7c5290d`](https://togithub.com/sindresorhus/got/commit/7c5290d) ### [`v11.0.2`](https://togithub.com/sindresorhus/got/releases/tag/v11.0.2) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.0.1...v11.0.2) - Fix `response.statusMessage` being null [`965bd03`](https://togithub.com/sindresorhus/got/commit/965bd03ad463afb9fdbe098a48b16269b54de9bd) - Update the `http2-wrapper` dependency to `1.0.0-beta.4.4` [`4e8de8e`](https://togithub.com/sindresorhus/got/commit/4e8de8e32cccaafddf0c6ef4f31716810ab4a14b) - Use `Merge` as it's stricter than the intersection operator [`d3b972e`](https://togithub.com/sindresorhus/got/commit/d3b972efaca28d8033468c7232a469e8cb034677) - Prevent silent rejections in rare cases [`8501c69`](https://togithub.com/sindresorhus/got/commit/8501c6901af4f7c74cd0ae3700b499bb42ce5928) - Do not alter `options.body` [`835c70b`](https://togithub.com/sindresorhus/got/commit/835c70bd6fdc5b1ba7e7ffd322490b6d66fb407e) ### [`v11.0.1`](https://togithub.com/sindresorhus/got/releases/tag/v11.0.1) [Compare Source](https://togithub.com/sindresorhus/got/compare/v11.0.0...v11.0.1) Fixed two regressions: - `HTTPError`s have unspecified response body ([#​1162](https://togithub.com/sindresorhus/got/issues/1162)) - Options are duplicated while merging ([#​1163](https://togithub.com/sindresorhus/got/issues/1163)) [Improved TypeScript types for errors inherited from `RequestError`](https://togithub.com/sindresorhus/got/commit/d914a7e7a0d97b03745b9b47623e4ac3532b4dae#diff-8eef38c70c64f535c3b8046b5ce40d9e) ### [`v11.0.0`](https://togithub.com/sindresorhus/got/releases/tag/v11.0.0) [Compare Source](https://togithub.com/sindresorhus/got/compare/v10.7.0...v11.0.0) Introducing Got 11! :tada: The last major version was in December last year. :snowflake: Since then, a huge amount of bugs has been fixed. There are also many new features, for example, **HTTP2 support** is finally live! :globe_with_meridians: *If you find Got useful, you might want to [sponsor the Got maintainers](https://togithub.com/sindresorhus/got?sponsor=1).* *** #### Breaking changes ##### Removed support for `electron.net` Due to the inconsistencies between the Electron's `net` module and the Node.js `http` module, we have decided to officially drop support for it. Therefore, the `useElectronNet` option has been removed. You'll still be able to use Got in the Electron main process and in the renderer process through the `electron.remote` module or if you use Node.js shims. ##### The Pagination API is now stable We haven't seen any bugs yet, so please give it a try! If you want to leave some feedback, you can do it [here](https://togithub.com/sindresorhus/got/issues/1052). Any suggestion is greatly appreciated! ```diff { - _pagination: {...} + pagination: {...} } ``` ##### API - The `options.encoding` behavior has been reverted back to the Got 9 behavior. In other words, the options is only meant for the Got promise API. To set the encoding for streams, simply call `stream.setEncoding(encoding)`. ```diff -got.stream('https://sindresorhus.com', {encoding: 'base64'}); +got.stream('https://sindresorhus.com').setEncoding('base64'); // Promises stay untouched await got('https://sindresorhus.com', {encoding: 'base64'}); ``` - The error name `GotError` has been renamed to `RequestError` for better readability and to comply with the documentation. ```diff -const {GotError} = require('got'); +const {RequestError} = require('got'); ``` - The `agent` option now accepts **only an object** with `http`, `https` and `http2` properties. While the `http` and `https` properties accept native `http(s).Agent` instances, the `http2` property must be an instance of [`http2wrapper.Agent`](https://togithub.com/szmarczak/http2-wrapper#new-http2agentoptions) or be undefined. ```diff { - agent: new https.Agent({keepAlive: true}) } { + agent: { + http: new http.Agent({keepAlive: true}), + https: new https.Agent({keepAlive: true}), + http2: new http2wrapper.Agent() + } } ``` - The `dnsCache` option is now set to a default instance of [`CacheableLookup`](https://togithub.com/szmarczak/cacheable-lookup). It cannot be a `Map`-like instance anymore. The underlying [`cacheable-lookup`](https://togithub.com/szmarczak/cacheable-lookup) package has received many improvements, for example, it has received `hosts` file support! Additionally, the `cacheAdapter` option has been renamed to `cache`. Note that it's no longer passed to [Keyv](https://togithub.com/lukechilds/keyv), so you need to pass a Keyv instance it if you want to save the data for later. ```diff { - dnsCache: new CacheableLookup({ - cacheAdapter: new Map() - }) } { + dnsCache: new CacheableLookup({ + cache: new Keyv({ + cacheAdapter: new Map() + }) + }) } // Default: { dnsCache: new CacheableLookup() } ``` - Errors thrown in `init` hooks will be converted to instances of `RequestError`. `RequestError`s provide much more useful information, for example, you can access the Got options (through `error.options`), which is very useful when debugging. ```js const got = require('got'); (async () => { try { await got('https://sindresorhus.com', { hooks: { init: [ options => { if (!options.context) { throw new Error('You need to pass a `context` option'); } } ] } }); } catch (error) { console.log(`Request failed: ${error.message}`); console.log('Here are the options:', error.options); } })(); ``` - The options passed in an `init` hook may not have a `url` property. To modify the request URL you should use a `beforeRequest` hook instead. ```diff { hooks: { - init: [ + beforeRequest: [ options => { options.url = 'https://sindresorhus.com'; } ] } } ``` Note that this example shows a simple use case. In more complicated algorithms, you need to split the `init` hook into another `init` hook and a `beforeRequest` hook. - The `error.request` property is no longer a `ClientRequest` instance. Instead, it gives a Got stream, which provides a set of useful properties. ```js const got = require('got'); (async () => { try { await got('https://sindresorhus.com/notfound'); } catch (error) { console.log(`Request failed: ${error.message}`); console.log('Download progress:', error.request.downloadProgress); } })(); ``` ##### Renamed TypeScript types Some of the TypeScript types have been renamed to improve the readability: <table> <tr> <td>Old type</td> <td>New type</td> </tr> <tr> <td><code>ResponseObject</code></td> <td><code>Response</code></td> </tr> <tr> <td><code>Defaults</code></td> <td><code>InstanceDefaults</code></td> </tr> <tr> <td><code>DefaultOptions</code></td> <td><code>Defaults</code></td> </tr> <tr> <td><code>DefaultRetryOptions</code></td> <td><code>RequiredRetryOptions</code></td> </tr> <tr> <td><code>GotOptions</code></td> <td><code>Options</code></td> </tr> <tr> <td><code>GotRequestMethod</code></td> <td><code>GotRequestFunction</code></td> </tr> </table> ##### Other - Now requires Node.js 10.19 or later. #### Enhancements HTTP2 support is here! Excited? Yay! Unfortunately, it's off by default to make the migration smoother. Many Got users have set up their own Agents and we didn't want to break them. But fear no more, it will come enabled by default in Got 12. ```js const got = require('got'); (async () => { const response = await got('https://nghttp2.org/httpbin/anything', {http2: true}); console.log(response.socket.alpnProtocol); //=> 'h2' })(); ``` 1. The `merge` function is slow ([#​1016](https://togithub.com/sindresorhus/got/issues/1016)) 2. Use `error.code` instead of `error.message` to compare errors ([#​981](https://togithub.com/sindresorhus/got/issues/981)) 3. Pass error thrown in the `init` hook to `beforeError` hook ([#​929](https://togithub.com/sindresorhus/got/issues/929)) 4. Errors have undefined body when using streams ([#​1138](https://togithub.com/sindresorhus/got/issues/1138)) 5. Spaces should be normalized as `+` in query strings ([#​1113](https://togithub.com/sindresorhus/got/issues/1113)) 6. Modify response headers while using `got.stream(...)` ([#​1129](https://togithub.com/sindresorhus/got/issues/1129)) 7. Make `error.request` a Got stream ([`af0b147`](https://togithub.com/sindresorhus/got/commit/af0b1472abf48a6c5491dcb36a1d8863c5227fb3)). #### Known bugs 1. When some errors occur, the `timings` may indicate that the request was successful although it failed. 2. When some errors occur, the `downloadProgress` object may show incorrect data. #### Bug fixes 1. Requests to UNIX sockets are missing query strings ([#​1036](https://togithub.com/sindresorhus/got/issues/1036)) 2. `beforeRequest` hooks aren't called on redirects ([#​994](https://togithub.com/sindresorhus/got/issues/994)) 3. Errors are swallowed when using `stream.pipeline(got.stream(...), ...)` ([#​1026](https://togithub.com/sindresorhus/got/issues/1026)) 4. Cannot use the `cache` along with the `body` option ([#​1021](https://togithub.com/sindresorhus/got/issues/1021)) 5. Got doesn't throw on leading slashes ([#​1057](https://togithub.com/sindresorhus/got/issues/1057)) 6. Got throws when passing already frozen options ([#​1050](https://togithub.com/sindresorhus/got/issues/1050)) 7. Cannot type Got options properly due to missing types ([#​954](https://togithub.com/sindresorhus/got/issues/954)) 8. `got.mergeOptions(...)` doesn't merge `URLSearchParams` instances ([#​1011](https://togithub.com/sindresorhus/got/issues/1011)) 9. The `authorization` header is leaking ([#​1090](https://togith </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/X-oss-byte/Nextjs).
const http = require('http');
const request = http.get('http://httpbin.org/anything', response => {
setTimeout(() => {
console.log(`request.destroyed = ${request.destroyed}`);
console.log(`response.destroyed = ${response.destroyed}`);
response.destroy(new Error('failure'));
}, 1000);
});
AFAICT,this is no longer reproducible. If you disagree, feel free to re-open. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Linux solus 5.6.19-159.current #1 SMP PREEMPT Fri Oct 16 17:49:06 UTC 2020 x86_64 GNU/Linux
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
An error with a message
failure
.What do you see instead?
No error.
Additional information
While I understand that
request
is destroyed on socket close, theresponse.destroy
logic is broken:node/lib/_http_incoming.js
Lines 121 to 125 in c1da528
The error is not thrown because the socket has been destroyed. Although the response has not.
The text was updated successfully, but these errors were encountered: