Registry / http-networking / got
library0.0.1jsnpmunverified

Got is a human-friendly and powerful HTTP request library for Node.js, currently at v15.0.2. It provides a modern Promise-based API for making HTTP requests, including features like retry mechanisms, hooks, and stream support. The library is actively maintained with frequent patch releases and major version updates that may introduce breaking changes, notably requiring Node.js 22+ and being ESM-only since v12 (reiterated in v15).

npm install got
INSTALL
IMPORT
SIG · GOT
G
got
http-networkingjavascriptv0.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

got
import got from 'got';
const got = require('got');
Got is native ESM. CommonJS `require()` is not supported.

Demonstrates making a POST request with a JSON payload and receiving a JSON response using Got's dedicated JSON mode.

import got from 'got'; (async () => { try { const { data } = await got.post('https://httpbin.org/anything', { json: { hello: 'world' } }).json(); console.log('Response data:', data); // Expected output: { "hello": "world" } } catch (error) { console.error('Request failed:', error); } })();
Debug
Known issues
breakingGot v15.0.0 and later require Node.js 22 or higher.
fix
Upgrade your Node.js runtime to version 22 or newer.
affects: >=15.0.0
breakingThe `promise.cancel()` API was removed in v15.0.0.
fix
Use the standard `AbortController` and the `signal` option for request cancellation. For example: `const controller = new AbortController(); got('url', { signal: controller.signal }); controller.abort();`
affects: >=15.0.0
breakingThe `isStream` option has been removed in v15.0.0.
fix
Use `got.stream()` directly for streaming requests instead of the `isStream` option.
affects: >=15.0.0
gotchaGot is a native ESM package and does not provide a CommonJS export. Attempting to `require()` it will result in an error.
fix
Ensure your project is configured for ESM, or use dynamic `import()` if you cannot fully convert to ESM. For example: `const got = await import('got');`
affects: >=12.0.0
gotchaThe `got` maintainers recommend considering `Ky` (for browser compatibility, smaller size, Fetch API base) or `fetch-extras` (for simpler needs) as alternatives.
fix
Evaluate if `Ky` or `fetch-extras` better fit your project's requirements, especially if you need browser support or a lighter-weight API.
affects: *
Errors
Common errors & fixes
TypeError: promise.cancel is not a function
Attempting to call the `cancel()` method on a `got` promise, which was removed in v15.0.0.
fix
Refactor your cancellation logic to use `AbortController` and the `signal` option: `const controller = new AbortController(); got('url', { signal: controller.signal }); controller.abort();`
TypeError [ERR_REQUIRE_ESM]: require() of ES Module .../node_modules/got/dist/index.js from ... not supported.
Trying to import `got` using `require()` in a CommonJS module, but `got` is an ESM-only package.
fix
Convert your project or the specific file to use ES modules (`import`). Alternatively, use dynamic import: `const got = await import('got');`
write after end
A bug in `got` versions 14.6.0 to 14.6.5 incorrectly auto-closed streams for empty PATCH/DELETE/OPTIONS requests, preventing data from being piped to them.
fix
Upgrade `got` to version 14.6.6 or higher to resolve the stream auto-end issue for PATCH/DELETE/OPTIONS methods.
TypeError: Argument for option 'isStream' must be a boolean
Using the `isStream` option with a boolean value in `got` v15.0.0+, where this option has been removed.
fix
Remove the `isStream` option. Instead, use `got.stream()` directly for all streaming use cases.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
got — npm install got · libregistry