Skip to content

Update dependency got to v15#508

Open
renovate[bot] wants to merge 1 commit intomainfrom
renovate/got-15.x
Open

Update dependency got to v15#508
renovate[bot] wants to merge 1 commit intomainfrom
renovate/got-15.x

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate bot commented Apr 4, 2026

This PR contains the following updates:

Package Change Age Confidence
got 14.6.615.0.0 age confidence

Release Notes

sindresorhus/got (got)

v15.0.0

Compare Source

Breaking changes

  • Require Node.js 22 b933476
  • Remove promise cancel API a06ac6c
  • Remove isStream option c241c6c
    • Use got.stream() directly.
  • Use native FormData global 670b228
  • responseType: 'buffer' returns Uint8Array instead of Buffer 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
    • 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
    • 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
    • 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
    • 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
    • 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
  • uploadProgress now emits granular per-chunk events for json and form request bodies 13c889d

Migration guide

Replace promise.cancel() with AbortController

Before:

const promise = got(url);
promise.cancel();

After:

const controller = new AbortController();
const promise = got(url, {signal: controller.signal});
controller.abort();
Replace isStream: true with got.stream()

Before:

got(url, {isStream: true});

After:

got.stream(url);
Replace form-data / form-data-encoder with native FormData

Before:

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:

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:

const data = await got(url).buffer();
const copy = Buffer.from(data);

After:

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:

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:

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:

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.



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: Never, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.23%. Comparing base (1480f87) to head (26d8ed6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #508   +/-   ##
=======================================
  Coverage   99.23%   99.23%           
=======================================
  Files         127      127           
  Lines        6404     6404           
  Branches     1227     1227           
=======================================
  Hits         6355     6355           
  Misses         49       49           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants