Commit bfa8bb8
authored
fix(deps): update dependency got to v15 (#354)
This PR contains the following updates:
| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [got](https://redirect.github.com/sindresorhus/got) | [`^14.6.6` →
`^15.0.1`](https://renovatebot.com/diffs/npm/got/14.6.6/15.0.1) |

|

|
---
### Release Notes
<details>
<summary>sindresorhus/got (got)</summary>
###
[`v15.0.1`](https://redirect.github.com/sindresorhus/got/releases/tag/v15.0.1)
[Compare
Source](https://redirect.github.com/sindresorhus/got/compare/v15.0.0...v15.0.1)
- Fix init types
[`20633bc`](https://redirect.github.com/sindresorhus/got/commit/20633bc)
***
###
[`v15.0.0`](https://redirect.github.com/sindresorhus/got/releases/tag/v15.0.0)
[Compare
Source](https://redirect.github.com/sindresorhus/got/compare/v14.6.6...v15.0.0)
#### Breaking changes
- Require Node.js 22
[`b933476`](https://redirect.github.com/sindresorhus/got/commit/b933476)
- Remove promise cancel API
[`a06ac6c`](https://redirect.github.com/sindresorhus/got/commit/a06ac6c)
- `promise.cancel()` is gone. Use the [`signal`
option](https://redirect.github.com/sindresorhus/got/blob/main/documentation/2-options.md#signal)
with
[`AbortController`](https://developer.mozilla.org/docs/Web/API/AbortController)
instead.
- Remove `isStream` option
[`c241c6c`](https://redirect.github.com/sindresorhus/got/commit/c241c6c)
- Use `got.stream()` directly.
- Use native `FormData` global
[`670b228`](https://redirect.github.com/sindresorhus/got/commit/670b228)
- Use the [Web API
`FormData`](https://developer.mozilla.org/docs/Web/API/FormData) global
directly (available in Node.js 18+).
- `responseType: 'buffer'` returns `Uint8Array` instead of `Buffer`
[`309e36d`](https://redirect.github.com/sindresorhus/got/commit/309e36d)
- `response.rawBody` and `promise.buffer()` now return a `Uint8Array`.
`Buffer` is a subclass of `Uint8Array`, so most code will continue to
work, but strict type checks will need updating.
- `strictContentLength` defaults to `true`
[`08e9dff`](https://redirect.github.com/sindresorhus/got/commit/08e9dff)
- Got now throws a `ContentLengthMismatchError` by default if
`Content-Length` doesn't match the actual body size. Set
`{strictContentLength: false}` to restore the old behavior.
- `retry.enforceRetryRules` defaults to `true`
[`9bc8dfb`](https://redirect.github.com/sindresorhus/got/commit/9bc8dfb)
- Custom `calculateDelay` functions are now only called when a retry is
actually allowed by `limit`, `methods`, `statusCodes`, and `errorCodes`.
If your `calculateDelay` was previously used to override retry
eligibility unconditionally, set `{retry: {enforceRetryRules: false}}`.
- Piped header copying is now opt-in
[`8e392f3`](https://redirect.github.com/sindresorhus/got/commit/8e392f3)
- Got no longer automatically copies headers from a piped stream. Set
`{copyPipedHeaders: true}` to re-enable. Hop-by-hop headers are never
copied even when enabled (RFC 9110 §7.6.1).
- `url` removed from public options objects
[`87de8d6`](https://redirect.github.com/sindresorhus/got/commit/87de8d6)
- The `url` property is no longer present on the options object passed
to hooks. Use `response.url` or `request.requestUrl` instead.
- 300 and 304 responses are no longer auto-followed
[`5fccaab`](https://redirect.github.com/sindresorhus/got/commit/5fccaab)
- Per RFC 9110, 304 is a conditional-GET hint, not a redirect, and 300
is only a SHOULD for user agents. Got now returns these responses as-is.
Handle them manually if needed.
#### Improvements
- Stream decode large `text`/`json` bodies incrementally for lower peak
memory usage
[`c9a95b1`](https://redirect.github.com/sindresorhus/got/commit/c9a95b1)
- `uploadProgress` now emits granular per-chunk events for `json` and
`form` request bodies
[`13c889d`](https://redirect.github.com/sindresorhus/got/commit/13c889d)
***
#### Migration guide
##### Replace `promise.cancel()` with `AbortController`
**Before:**
```js
const promise = got(url);
promise.cancel();
```
**After:**
```js
const controller = new AbortController();
const promise = got(url, {signal: controller.signal});
controller.abort();
```
##### Replace `isStream: true` with `got.stream()`
**Before:**
```js
got(url, {isStream: true});
```
**After:**
```js
got.stream(url);
```
##### Replace `form-data` / `form-data-encoder` with native `FormData`
**Before:**
```js
import {FormData} from 'formdata-node';
// or: import {FormData} from 'formdata-polyfill/esm.min.js';
const form = new FormData();
form.set('name', 'value');
await got.post(url, {body: form});
```
**After:**
```js
const form = new FormData();
form.set('name', 'value');
await got.post(url, {body: form});
```
##### Update `Buffer` usage to `Uint8Array`
`response.rawBody` and `promise.buffer()` now return `Uint8Array`
instead of `Buffer`.
**Before:**
```js
const data = await got(url).buffer();
const copy = Buffer.from(data);
```
**After:**
```js
const data = await got(url).buffer();
const copy = new Uint8Array(data);
```
If you need `Buffer`-specific APIs, wrap with `Buffer.from(data.buffer,
data.byteOffset, data.byteLength)`.
##### `strictContentLength` is now on by default
If you send requests where the `Content-Length` header might not match
the actual body size, opt out:
```js
got.extend({strictContentLength: false});
```
##### `retry.enforceRetryRules` is now on by default
If your `calculateDelay` function was overriding retry eligibility (e.g.
retrying on methods or status codes outside the defaults), opt out:
```js
got.extend({
retry: {
enforceRetryRules: false,
calculateDelay: ({computedValue}) => {
// computedValue is 0 when retry is not allowed
if (computedValue === 0) {
return 0;
}
return computedValue;
},
},
});
```
##### Piped header copying is now opt-in
If you pipe streams into Got and rely on automatic header forwarding
(e.g. `Content-Type`), re-enable it:
```js
got.extend({copyPipedHeaders: true});
```
##### 300 and 304 responses are no longer followed
If your code depended on Got auto-following 300 Multi-Choice or handling
304 Not Modified as a redirect, you now need to handle them yourself in
an `afterResponse` hook or check `response.statusCode` manually.
***
</details>
---
### Configuration
📅 **Schedule**: (in timezone America/New_York)
- Branch creation
- "every weekend"
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, 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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/dylang/source-map-diff).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDIuMTEiLCJ1cGRhdGVkSW5WZXIiOiI0My4xMTAuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>1 parent 2ee8d31 commit bfa8bb8
2 files changed
Lines changed: 41 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments