Sending an HTTP request is easy until a service returns a rate limit, a response body stops halfway through or a retry creates the same operation twice. A JavaScript HTTP client should make those decisions visible and consistent across the application.
Fetch API, Axios, Ky, Got and Undici differ in runtime scope and how much request policy they provide. Fetch is a platform API, Ky builds on it, Axios offers its own response conventions, and Got and Undici focus on Node.js needs. Choose around the environment and failure behavior you must support, rather than a library’s shortest successful-request example.
Runtime comes before convenience
Browser code operates under browser origin, cookie and cross-origin rules. Server code owns a different network environment, often with connection pools, proxies and long-running processes. A package available in two runtimes does not make their permissions or transport options identical.
For Python services, our Python HTTP client comparison covers the corresponding language choice. For JavaScript, first identify which requests run in a browser, a Node process or another runtime, then define one policy for deadlines, retries and redacted diagnostics.
The quick difference
| Tool | Best fit | Strength and boundary |
|---|---|---|
| Fetch API | Portable platform-style requests | Request and Response primitives; check HTTP status and define policy explicitly. |
| Axios | Shared application request conventions | Convenient data responses and structured errors; adapters and defaults require review. |
| Ky | Fetch-based application wrappers | Method helpers, retries and hooks; align documentation with the installed release. |
| Got | Feature-rich Node.js integrations | Streams, pagination and request controls; native ESM and retry defaults matter. |
| Undici | Node.js transport and pooling control | Dispatchers and explicit pools; bundled fetch and installed module differ. |
Fetch API
The Fetch API provides Request and Response objects with promise-based requests. It is built into modern browsers and available in current Node.js releases. A response with an HTTP error status normally fulfills the request promise, so application code must inspect status or response.ok rather than assuming every resolved promise succeeded.
Its advantage is a standard interface without an additional wrapper dependency. The tradeoff is owning repeated policy: response parsing, cancellation, error messages and any retry mechanism. Streams and response bodies also have consumption rules that matter when logging or forwarding data. Start here when your needs are modest or portability is valuable. Build a small, reviewed application boundary around it so every caller does not invent a different meaning of success. A built-in API can simplify dependencies while still requiring substantial operational decisions.
Axios
Axios provides method helpers and a response object whose data property contains the response payload. Its current documentation supports import and require usage, with environment-specific bundles when resolution needs explicit control. Structured errors distinguish an HTTP response from a request that produced no response and from request configuration problems.
The strength is a consistent application-facing convention that many teams can share. The limitation is that this convention is not interchangeable with native Response objects. Review error handling, status validation and the adapter used in your environment before replacing existing calls. A useful pilot covers cancellation, malformed payloads and a server error with a meaningful body. Axios fits projects that want a maintained client abstraction across application modules. Avoid putting secrets into diagnostic logs simply because the error object conveniently exposes request configuration.
Ky
Ky adds conveniences around Fetch, including method shortcuts, JSON handling, hooks, timeouts and retries. Its response model remains close to web-standard requests, making it attractive when a team likes Fetch but keeps rewriting the same application wrapper. Non-success HTTP responses become errors under the documented default behavior.
Policy defaults still need an owner. Decide which methods and status codes may retry, how the total deadline behaves and whether authentication hooks can change a repeated request. The repository’s main README explicitly describes the next version; use documentation tied to the installed release when implementing options. The current release history is linked in References for that reason. Shortlist Ky when a lightweight Fetch-oriented interface solves recurring work. Test an interrupted request and a rate-limited response before adopting its defaults across every integration.
Got
Got is a Node.js HTTP client with promise and stream interfaces, pagination, hooks and detailed timeout and retry controls. Its repository states that the package is native ESM and no longer provides a CommonJS export. It also warns that the older v11 line is no longer maintained.
Those are practical architecture constraints, not just syntax preferences. A CommonJS application should plan a supported integration rather than pinning an unmaintained release to avoid a migration. Got retries failures by default, so inspect that policy against operations that can create records or trigger work. Its broader request controls are useful for server integrations and data ingestion; they also create configuration that the team must understand. Evaluate streaming backpressure and pagination failure handling with representative responses. Choose it when Node-specific convenience justifies a dedicated client package.
Undici
Undici provides Node.js HTTP APIs with dispatchers, agents and pools. Node’s built-in fetch uses a bundled Undici version, while installing the module separately gives access to its own release line and additional APIs. These two choices should not be treated as identical dependency or compatibility decisions.
The strength is explicit transport ownership for services that need connection management, proxies or mocking. The cost is more responsibility for lifecycle and runtime compatibility. Check the module’s supported Node versions before upgrading, and keep its web-standard objects consistent when combining packages. Do not select it solely from upstream benchmark tables; your payloads, remote servers and connection reuse determine the relevant behavior. Undici fits Node services with concrete transport requirements and engineers prepared to manage those requirements through deployment and shutdown.
How to evaluate JavaScript request behavior
Write a small failure matrix before a migration: successful JSON, an empty response, invalid JSON, an authentication failure, a rate limit, a timeout and a connection interrupted while reading. Record whether each situation reaches the caller as a response, an exception or a partially consumed stream. Those distinctions affect user messages and background jobs.
Define retries using the operation’s semantics. A network timeout does not prove the remote service rejected a write. Where the server supports an idempotency key, preserve it across attempts; otherwise decide how the application will reconcile an uncertain result. Layered retries in a client, SDK and job queue can multiply traffic unexpectedly.
Compare the complete deadline rather than one timeout setting. Include connection establishment, response headers, body reads and any backoff between attempts. The interface should let callers cancel work that is no longer useful, and logs should connect retries without exposing authorization headers or private payloads.
These choices do not have comparable per-seat subscription prices. Evaluate dependency licenses for your distribution model and account for engineering, server resources and remote API charges separately. A proposed load test should use your own representative service conditions. This comparison makes no measured throughput, latency or reliability ranking.
Selection checklist
- Choose browser portability or Node-specific transport ownership first.
- Verify status handling, parsing failures and body consumption.
- Set retry methods, attempt limits and total deadlines explicitly.
- Check ESM, runtime versions and release-specific documentation.
- Keep cancellation and secret-safe diagnostics consistent across callers.
Choosing for your needs
Fetch suits a direct platform baseline; Axios offers shared response conventions; Ky adds Fetch-oriented conveniences; Got supports extensive Node integrations; Undici exposes Node transport control. A dependable choice is the one whose failure and retry behavior the team can explain. Prefer a narrow application policy over an assortment of unrelated defaults.
References
Official sources checked November 26, 2026. Availability, documentation and regional purchase terms can change.
