CodeVetter
← All unpacks
CodeVetter · Repo Unpack evidence

sindresorhus/got

Scanned commit e1d87d2ced dated 2026-09-20 — last upstream commit. Generated by codevetter 1.15.0 on 2026-10-02.

github.com/sindresorhus/got ↗ · 129 files · 1.8 MB

Sindre's open source work is supported by the community.

Deep analysis by cli:codex via the codex CLI on 2026-10-02 (426s) — every claim below links to its cited source files. Source inspection; upstream code and tests were not executed.

Overview

Got 16 is a TypeScript HTTP client library for Node.js 22 and newer, distributed as native ESM. It serves applications that need buffered Promise requests, streaming uploads and downloads, pagination, configurable retries, and detailed transport control. Its distinctive architecture shares a Duplex request engine across both APIs while allowing custom instances, middleware handlers, lifecycle hooks, cache adapters, and request implementations.

System map

The runtime is a callable library instance built around a shared request engine. Factory code selects the outward Promise or stream interface, while Options centralizes configuration and Request owns transport lifecycle state. HTTP caching, DNS caching, and HTTP/2 pooling occupy separate state boundaries. Distribution and CI are defined by package.json, tsconfig.json, and one inspected GitHub Actions workflow.

Feature catalog

The public surface includes ordinary HTTP calls, buffered body shortcuts, Duplex streams, and asynchronous pagination. Reliability controls include redirects, retry rules, timeouts, abort signals, and structured errors. Custom instances and hooks let applications adapt the client to particular services. Transport, caching, and diagnostic APIs expose capabilities needed by Node applications beyond a basic request wrapper.

Data flow

Inputs become normalized Options before native transport options are constructed. Request serializes payloads, prepares generated headers, and reconciles hook mutations before sending data. Incoming messages become decorated responses and either flow outward as stream chunks or accumulate for Promise parsing. Cache adapters, cookie jars, DNS stores, and HTTP/2 pools retain different kinds of state across calls.

Behavior traces

Eight source walks cover instance initialization and the main user-visible execution paths. The Promise and stream paths share normalization and transport setup but differ in upload completion and response buffering. Redirect and retry paths preserve or replace request state under distinct rules. Cache reuse, cookie persistence, and pagination reconnect retained state to later requests.

Testing signals

Tests and CI were inspected, not executed; no passing result or measured coverage is asserted. The inspected suite uses AVA, TypeScript assertions, local HTTP servers, and selected fake timers. Regression cases exercise transport identity, cross-origin behavior, buffering, caching, retries, and timeout budgets. The inventory is bounded, and explicit skipped or expected-failing cases limit what test presence establishes.

Risk map

These are source observations and explicitly labeled hypotheses, not confirmed vulnerabilities. Important boundaries include inherited credentials, redirect payload replay, diagnostic subscribers, local sockets, and caller-supplied transport settings. Async hooks and stream cleanup couple several request states, making seemingly small edits consequential. Buffering and a documented cache dependency limitation warrant targeted validation in a later execution-authorized task.

Extension points

Extension is primarily instance composition and callback-based customization. Handler middleware wraps the request interface, while lifecycle hooks operate at specific normalization and transport stages. Request functions, connection factories, agents, cookie jars, and cache adapters substitute infrastructure without replacing the public client. Pagination and JSON callbacks customize data interpretation and follow-up behavior.

Contributor handoff

Begin at the factory, normalized options, shared Request engine, and Promise adapter before editing public behavior. Tests and CI were inspected, not executed, and this brief does not establish exhaustive coverage or passing checks. Focus changes on the owning layer while checking the corresponding Promise, stream, and follow-up paths. Preserve public typing, generated-header distinctions, and resource cleanup contracts.

Languages

LanguageFilesShare of source
TypeScript8493%
Markdown27docs/config
JavaScript67%
JSON2docs/config
YAML2docs/config

Start reading here

Probable source entrypoint: source/index.ts — inferred from the directory tree and manifest, not the upstream docs.

Source roots

source/ (27 files)

Source layout — source/

PathFiles
source/as-promise/2
source/core/22
source/create.ts1
source/index.ts1
source/types.ts1

Repository structure

Top-level pathFiles
test/57
source/27
documentation/26
.github/7
benchmark/2
media/1

Docs found: documentation/1-promise.mddocumentation/10-instances.mddocumentation/2-options.mddocumentation/3-streams.mddocumentation/4-pagination.mddocumentation/5-https.mddocumentation/6-timeout.mddocumentation/7-retry.mddocumentation/8-errors.mddocumentation/9-hooks.md

Package

package.json — got v16.0.0, 50 declared dependencies.

@hapi/bourne@sindresorhus/is@sindresorhus/tsconfig@sinonjs/fake-timers@types/benchmark@types/express@types/node@types/pem@types/readable-stream@types/request@types/sinon@types/sinonjs__fake-timers

CI & config entrypoints

Structural health signals

Average score 8.2/10 across 90 analyzed source files; 8 hotspots surfaced.

These are deterministic review leads — size, churn, and structural signals — not proof of a bug in this project.

Recent history