# Data flow — sindresorhus/got

> Canonical page: https://codevetter.com/unpack/got/data-flow

# Data flow — sindresorhus/got

Scanned commit e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4 (2026-09-20). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

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.
- The public factory rejects url properties inside options objects; Options clones defaults, merges overrides, then assigns the URL so explicit searchParams replace URL query parameters. — [source/create.ts#L40-L68](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/create.ts#L40-L68) [source/core/options.ts#L1643-L1684](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/options.ts#L1643-L1684) [source/core/options.ts#L2172-L2175](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/options.ts#L2172-L2175)
- _finalizeBody() turns form into URLSearchParams text, JSON into stringifyJson output, and native FormData into a serialized body; generated content-type and known content-length headers accompany those transformations. — [source/core/index.ts#L973-L1008](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L973-L1008) [source/core/index.ts#L1011-L1028](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L1011-L1028)
- _makeRequest() derives Basic authorization from username/password unless overridden or explicitly omitted, obtains cookie strings from the jar, then awaits beforeRequest hooks before reconciling changed headers and URL boundaries. — [source/core/index.ts#L2422-L2424](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L2422-L2424) [source/core/index.ts#L2464-L2474](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L2464-L2474) [source/core/index.ts#L2489-L2519](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L2489-L2519) [source/core/index.ts#L2544-L2567](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L2544-L2567)
- createNativeRequestOptions() maps TLS settings, headers, agent, lookup, family, and createConnection into Node transport fields; Unix URLs become socketPath/path options only when enableUnixSockets permits them. — [source/core/options.ts#L3536-L3554](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/options.ts#L3536-L3554) [source/core/options.ts#L3556-L3593](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/options.ts#L3556-L3593)
- _onResponseBase() attaches sanitized final URL, original request URL, redirects, request reference, cache origin, IP, and retry count; final responses are decompressed when enabled, while followed redirect bodies are drained without decompression. — [source/core/index.ts#L1073-L1094](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L1073-L1094) [source/core/index.ts#L1249-L1256](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L1249-L1256)
- Promise mode gathers chunks with _setRawBody() into Uint8Array, optionally caches incremental UTF-8 decoding, then parseBody() produces text, JSON, or bytes; stream mode emits response and forwards readable data without that buffered completion gate. — [source/core/index.ts#L1529-L1552](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L1529-L1552) [source/core/index.ts#L1594-L1620](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L1594-L1620) [source/core/response.ts#L178-L204](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/response.ts#L178-L204)
- Cross-origin follow-up options are merged through mergeNextRequestOptions(), which handles explicit body replacement, cookie-jar removal, URL/query overrides, and stripping inherited credentials/body unless replacements were explicitly supplied. — [source/core/options.ts#L2905-L2921](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/options.ts#L2905-L2921) [source/core/options.ts#L2932-L2959](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/options.ts#L2932-L2959) [source/as-promise/index.ts#L100-L131](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/as-promise/index.ts#L100-L131) [source/create.ts#L310-L315](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/create.ts#L310-L315)
- State retention is delegated: Set-Cookie values are written to the supplied jar in wire order, HTTP representations use the supplied cache adapter, and DnsCache stores resolved entries with clear-version checks that prevent stale asynchronous writes from surviving invalidation. — [source/core/index.ts#L1221-L1233](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L1221-L1233) [source/core/index.ts#L2292-L2296](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/index.ts#L2292-L2296) [source/core/utils/dns-cache.ts#L562-L588](https://github.com/sindresorhus/got/blob/e1d87d2ced01d5b7d855a7dc8b091bf7b014a1e4/source/core/utils/dns-cache.ts#L562-L588)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
