unstale

npm / ky

ky

What changed in ky 1 to 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-17.

12 breaking1 security17 new APIs and options6 behavior and defaults33 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.1.0 on npm

ky 254 changes

Breaking changes 12

  • Invalid options and errors thrown by init hooks now reject the returned promise instead of throwing synchronously.

    2.2.0release notes

  • Invalid options now throw a TypeError naming the option instead of being silently ignored or failing later with an internal error.

    2.2.0release notes

  • In init hooks, header names are now lowercase, so read and delete headers using lowercase names.

    2.2.0release notes

  • Malformed HTTP URLs are rejected when using baseUrl.

    2.1.0release notes

  • Hook errors are fatal outside retry handling.

    2.0.0release notes

  • All hooks now receive a single state object instead of separate arguments; the beforeError state also includes request and options.

    2.0.0release notes

  • Calling .json() on an empty body or a 204 response now throws a parse error instead of returning an empty string.

    2.0.0release notes

  • Ky now requires Node.js 22.

    2.0.0release notes

  • Ky-specific properties are no longer present on the normalized options object passed to hooks.

    2.0.0release notes

  • Renames prefixUrl to prefix and allows leading slashes in input; prefix joins strings rather than resolving URLs.

    2.0.0release notes

  • The option is renamed to prefix.

    2.0.0release notes

  • Query parameters now merge with those in the input URL instead of replacing them.

    2.0.0release notes

Security 1

New APIs and options 12

  • Hooks can return {options: {...}} to change options such as timeout, fetch, or progress callbacks for subsequent attempts.

    2.2.0release notes

  • Limits the response body size in bytes after decompression; exceeding the limit throws a ResponseSizeError.

    2.2.0release notes

  • Upload progress and streamed Request bodies are supported in Bun and Deno.

    2.2.0release notes

  • A response body exceeding maxResponseSize throws this new error.

    2.2.0release notes

  • Adds support for the QUERY method.

    2.1.0release notes

  • Adds standard URL resolution: leading-slash paths resolve from the origin root, while other paths resolve relative to the base path.

    2.0.0release notes

  • Adds a data property containing the automatically consumed and pre-parsed response body, making error details immediately available.

    2.0.0release notes

  • Adds the init hook.

    2.0.0release notes

  • Adds Standard Schema validation support for .json().

    2.0.0release notes

  • Adds the NetworkError class and tightens retry logic.

    2.0.0release notes

  • Adds a helper for .extend().

    2.0.0release notes

  • Adds an overall timeout that applies across all retries.

    2.0.0release notes

Behavior and default changes 3

  • beforeError hooks now run for errors thrown while reading the response body; a dropped connection during body reading is reported as a NetworkError.

    2.2.0release notes

  • The hook now receives all error types, not only HTTPError, in its state object.

    2.0.0release notes

  • The parseJson option now receives request and response context.

    2.0.0release notes

Fixes and other changes 26

  • Aborts and timeouts cancel requests returned from hooks, interrupt pending hooks and body reads, avoid being reported as NetworkError and retried in Chromium, and enforce totalTimeout when a response or body arrives after the deadline.

    2.2.0release notes

  • Option merging preserves class instances, matches header names case-insensitively, and prevents changes in extend callbacks and init hooks from leaking into other requests.

    2.2.0release notes

  • Setting fetch to window.fetch no longer throws “Illegal invocation” in browsers.

    2.2.0release notes

  • isTimeoutError() and other type guards no longer match unrelated errors that share the same name.

    2.2.0release notes

  • Progress events now report the correct totalBytes for compressed responses and include response properties.

    2.2.0release notes

  • Using onUploadProgress no longer breaks uploads without request stream support or keepalive and no-cors requests.

    2.2.0release notes

  • parseJson is no longer ignored by response.clone().json() or when using onDownloadProgress.

    2.2.0release notes

  • Edge cases in replaceOption() are fixed.

    2.2.0release notes

  • The request property on Ky errors now refers to the request that was sent instead of an internal clone.

    2.2.0release notes

  • When retry.shouldRetry returns true, Ky respects Retry-After and rate-limit headers.

    2.2.0release notes

  • Using searchParams with a Request input no longer drops its body or options such as credentials.

    2.2.0release notes

  • Types accept readonly arrays and explicit undefined for all options, allow custom error names, and correct the .clone() and .bytes() return types.

    2.2.0release notes

  • Fixes extend() dropping a numeric retry limit when merging with an object.

    2.1.0release notes

  • Allows parseJson to handle empty response bodies.

    2.1.0release notes

  • Fixes progress callbacks for requests and responses with empty bodies.

    2.1.0release notes

  • Improves handling of the Retry-After header.

    2.1.0release notes

  • Fixes handling of Safari errors with domains.

    2.1.0release notes

  • Fixes signal replacement when extending instances.

    2.1.0release notes

  • Prevents tuple searchParams mutations from leaking across init-hook requests.

    2.0.2release notes

  • Fixes URLSearchParams deletions in the init hook.

    2.0.2release notes

  • Improves compatibility with custom fetch implementations.

    2.0.1release notes

  • Fixes forwarding of fetch options.

    2.0.1release notes

  • Non-Error values returned by beforeError hooks are ignored.

    2.0.0release notes

  • The hook is no longer skipped when it returns a Request.

    2.0.0release notes

  • Opaque responses from no-cors requests no longer cause an HTTPError.

    2.0.0release notes

  • Unsupported request streams are now handled by gracefully ignoring onUploadProgress.

    2.0.0release notes

ky 115 changes

New APIs and options 5

Behavior and default changes 3

  • The type guard now includes ForceRetryError.

    1.14.2release notes

  • The throwHttpErrors option can now be a function.

    1.14.0release notes

  • beforeRetry hooks can now return a Request or Response.

    1.13.0release notes

Fixes and other changes 7

  • Fixes an empty context object being added to a merged json body.

    1.14.3release notes

  • Avoids awaiting response cancellation when a retry is forced.

    1.14.2release notes

  • Fixes response body cleanup after hooks run.

    1.14.2release notes

  • Fixes handling of uppercase retry.methods values and improves their typing.

    1.14.2release notes

  • Handles backoffLimit being undefined.

    1.14.1release notes

  • Fixes support for the next option in the Next.js edge runtime.

    1.13.0release notes

  • Fixes compatibility with a non-standard Retry-After header.

    1.13.0release notes