GitShow/sindresorhus/ky
sindresorhus

ky

๐ŸŒณ Tiny & elegant JavaScript HTTP client based on the Fetch API

by sindresorhus
fetchhttp-clienthttp-requestjavascriptjsjsonnpm-packagerequest
Star on GitHubForknpm

TypeScript

17.0k stars476 forks127 contributorsActive ยท 1w agoSince 2018v2.0.2MIT

Meet the team

See all 127 on GitHub โ†’
sindresorhus
sindresorhus284 contributions
sholladay
sholladay39 contributions
szmarczak
szmarczak6 contributions
whitecrownclown
whitecrownclown4 contributions
clicktodev
clicktodev4 contributions
mgcrea
mgcrea3 contributions
jabuj
jabuj3 contributions
poppinlp
poppinlp3 contributions

Languages

View on GitHub โ†’
TypeScript100%

Commit activity

Last 12 weeks ยท 10 commits

Full graph โ†’

Community health

4 of 6 standards met

Community profile โ†’
85
โœ“READMEโœ“Licenseโœ“Contributingโœ“Code of Conductโ—‹Issue Templateโ—‹PR Template

Recent PRs & issues

Active ยท 2 in progress ยท Last activity 1w ago
See all on GitHub โ†’
JSap0914
Fix: validate retry.afterStatusCodes is an arrayOpenPR

Bug and both validate that the provided value is an array at construction time, throwing a descriptive error immediately. was missing this same guard. Passing a non-array (e.g. a single status code number) silently passes through and only fails later inside as a confusing: This error appears during a retry attempt โ€” well after construction โ€” making it hard to diagnose. Fix Add the missing validation to so all three array options are consistent: Verification Result: 1 test passed (new test). Full : 85 tests passed, 0 failed. AI-assisted contribution.

JSap0914 ยท 2w ago
chatman-media
Fix `extend()` dropping numeric `retry` limit when merging with an objectOpenPR

Problem accepts a number as shorthand for (per the docs: "If is a number, it will be used as and other defaults will remain in place."). However, when a numeric is set on a parent instance and then extended with an object, the numeric limit is silently dropped and falls back to the default (): The reverse direction (object on the parent, number on the child) and the all-object case both work correctly โ€” only the number โ†’ object merge loses data. Cause In , is merged like any other nested object. When the parent value is the numeric shorthand () and the incoming value is an object, the recursion ends up as . A non-object source is skipped entirely by , so the is discarded and only survives โ€” the limit is lost. Fix Expand the numeric shorthand to before the deep merge, so extending it with an object preserves the limit. This mirrors the documented shorthand semantics and leaves every other case (object โ†’ object, object โ†’ number replacement, ) unchanged. Test Added a test in that sets on a parent, extends it with , and asserts the request is attempted times. It fails on (3 attempts) and passes with the fix (4 attempts).

chatman-media ยท 3w ago

Recent fixes

View closed PRs โ†’
greymoth-jp
Deep-clone json and context in init hooks (match searchParams)MergedPR

deep-clones (#861) and so init-hook mutations don't leak across requests, but and are still only shallow-cloned (one level). A nested mutation in a hook (e.g. on a reused ) leaks into subsequent requests. Existing tests only cover top-level mutation, so it's undetected. #861 established the deep-clone-nested-init-hook-structures pattern for ; / were left behind. The fix applies the same isolation (+2 tests). Verified both ways: old leaks the nested mutation, fix isolates it; top-level, Date, and class-instance cases preserved, 0 regression.

greymoth-jp ยท 4d ago
xiao-js
docs: correct inaccurate Retry-After term ("timeout" โ†’ "delay")MergedPR

The retry documentation describes the header value as a "date, timeout, or timestamp". "timeout" isn't one of the accepted forms. Per the HTTP spec the value is either a delay in seconds or an HTTP date, and ky additionally treats a large number as a Unix timestamp (). So the accurate set is delay / date / timestamp. This replaces the inaccurate "timeout" with "delay" in the readme and the matching JSDoc in . Docs-only, no behavior change.

xiao-js ยท 1w ago
bartlomieju
docs: add Deno to install instructionsMergedPR

๐Ÿ‘‹ Bartek from the Deno team here. The install instructions show , but not Deno. Since Deno is a drop-in replacement for npm these days, I'd like to add a Deno line so Deno users have a copy-pasteable command, in parity with the others: (As of Deno 2.8 there's no prefix needed, it's the same command shape as .) Totally fine to close this if you'd rather keep the list short, no hard feelings. Happy to adjust wording, placement, or move it to a docs site instead. _Disclosure: I work on Deno, so I have an interest here. The goal is parity with the package managers you already list, not promotion. This PR was prepared with AI assistance under human supervision: I review every change myself and personally respond to any comments or review feedback._

bartlomieju ยท 1w ago
Structured data for AI agents

Repository: sindresorhus/ky. Description: ๐ŸŒณ Tiny & elegant JavaScript HTTP client based on the Fetch API Stars: 16966, Forks: 476. Primary language: TypeScript. Languages: TypeScript (100%). License: MIT. Topics: fetch, http-client, http-request, javascript, js, json, npm-package, request, rest, tiny, whatwg-fetch. Latest release: v2.0.2 (2mo ago). Open PRs: 2, open issues: 0. Last activity: 1w ago. Community health: 85%. Top contributors: sindresorhus, sholladay, szmarczak, whitecrownclown, clicktodev, mgcrea, jabuj, poppinlp, joaovieira, cristobal and others.

ยท@ofershap

Replace github.com with gitshow.dev