Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages

Upgrades and deprecations

The npm request Package Is Deprecated: What to Use Instead

In short

The request package has been deprecated since 11 February 2020, and the registry still flags its last release, 2.88.2. For plain calls, use Node's built-in fetch. Pick got if you rely on retries, split timeouts or a cookie jar. Request signing such as OAuth 1 has no direct equivalent, and fetch has no built-in cookie jar.

Is request really deprecated, and does it still install?

The registry's latest manifest for request is version 2.88.2, and it carries the message "request has been deprecated, see https://github.com/request/request/issues/3142". The README opens with a Deprecated notice that says request is fully deprecated as of 11 February 2020 and that no new changes are expected.

The linked issue, titled "Request's Past, Present and Future", was posted by a maintainer on 30 March 2019. It proposed maintenance mode: no new features and no breaking changes, with bug fixes merged without promises.

The package is still served and still used. The npm downloads API reported 13,413,335 downloads for 11 to 17 November 2026, fetched on 19 November 2026. A download count shows usage, not health. The same manifest still pins old ranges for qs (~6.5.2), tough-cookie (~2.5.0) and form-data (~2.3.2), and I make no claim here about what that means for security.

Checked against: source 1, source 2, source 3, source 4

Which replacement should I start with?

Start with built-in fetch if your calls are plain requests with a JSON or text body. Node's docs say it is no longer experimental since v21.0.0, no longer behind a flag since v18.0.0, and built on undici. The cost is that it has no retry option, no timeout option and no cookie jar.

Choose got if the code leans on retries, per-phase timeouts, a cookie jar or streams. It is native ESM with no CommonJS export, and its latest registry release, 16.2.0, declares Node 22 or newer.

axios fits code that is shared with a browser. Its README documents a timeout that defaults to no limit, a proxy option and no retry or cookie jar.

node-fetch 3.3.2 is ESM-only; version 2 stays CommonJS and the README says critical fixes continue there. On a Node version that already has fetch, I would not add it for the same API.

Checked against: source 5, source 16, source 17, source 18, source 19, source 20

How do timeouts, retries, streams, proxies, cookies and forms map across?

This is the join the individual docs do not give you. Each cell below comes from that library's own documentation, and an empty answer means the page I fetched documents nothing for it.

In requestBuilt-in fetch (undici)gotaxiosnode-fetch
`timeout`: one value, connect and readNo option. `AbortSignal.timeout(ms)` per call; undici defaults are 10 s connect, 300 s headers, 300 s body`timeout` object: lookup, connect, secureConnect, socket, send, response, read, request`timeout` in ms, default 0 (none)AbortController with a timer in the README
No retryNone built in; undici `RetryAgent`, 5 retries by defaultOn by default, limit 2None documentedNone documented
`.pipe()` streamsWeb stream body; `Readable.fromWeb()` bridges to Node streams; undici adds `stream` and `pipeline``got.stream()``responseType: 'stream'`Body is a Node stream
`proxy` option and `HTTP_PROXY` variablesOpt in with `NODE_USE_ENV_PROXY=1`, or pass an undici `ProxyAgent` as `dispatcher`No option; pass a custom agent`proxy` option and the same variables`agent` option
`jar: true`, `request.jar()`No jar; undici cookie helpers only read and write headers`cookieJar` with tough-cookieNone documentedNot stored; raw `Set-Cookie` is readable
`form`, `formData`Global `FormData` body`form` object for urlencoded; `FormData` body`FormData` and automatic serialization`FormData` export

Checked against: source 2, source 5, source 6, source 7, source 8, source 9, source 10, source 11, source 12, source 13, source 14, source 15, source 18, source 19, source 21, source 22

What has no direct equivalent?

Some request features have no like-for-like option in the libraries above. These are the ones I would find first by searching the code for them.

  • Request signing. The got migration guide says there is no oauth, hawk, aws or httpSignature option and tells you to build a custom instance.
  • request.jar() and request.cookie(). Got says to use tough-cookie directly. Built-in fetch has no jar at all, so session handling there is yours to write.
  • request.defaults(). Got renames it got.extend(). For built-in fetch, I would write a small wrapper function.
  • followAllRedirects, forever, agentClass, agentOptions and pool. Got drops them, and for keep-alive it wants an agent with keepAlive set to true.
  • The (error, response, body) callback. Every option above returns a promise, so each call site changes shape.

Checked against: source 2, source 10, source 12

What changes behaviour even when an option maps?

Retries are the one that surprises people. Request had none, but got retries by default: limit 2, on GET, PUT, HEAD, DELETE, OPTIONS, TRACE and QUERY, and on status codes such as 429 and 502. Set retry.limit to 0 if you want request's old behaviour.

Timeouts need a decision. Request's README warns that without one a socket can stay open for minutes. Axios and built-in fetch can wait for a very long time by default: axios has no limit, and undici allows 300 seconds each for headers and body. See this fix page for fetch and this one for axios.

Got also changes smaller defaults. The json option is an object, not a boolean, headers are lowercased, and piped request headers are no longer copied unless you set copyPipedHeaders. With fetch, keep fetch and FormData from the same implementation, either both global or both from undici.

If your trigger was the callback shape, this page covers await on request. This post compares documentation. I did not run any migration for it, and it does not cover your own call sites.

Checked against: source 2, source 7, source 8, source 12, source 13, source 18

What else do people ask?

Is it safe to keep using request?

The registry flags it as deprecated and its README says no new changes are expected. I cannot say from these documents whether your use is exposed, so treat it as unmaintained code that you plan to replace.

Does Node have a built-in replacement?

Yes for simple calls. <code>fetch</code> is built in and based on undici, but it has no retry option, no timeout option and no cookie jar.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. This page compares vendor and project documents I fetched on 19 Nov 2026 (the npm registry, the request README and issue, Node.js, undici, got, axios and node-fetch docs). I did not run a request migration for it. It does not cover your own call sites, performance or security. Found a mistake? Tell me.

Keep reading

Next step

Have a project in mind?

Tell me about it. A discovery call within 48 hours.