# Extension points — axios/axios

> Canonical page: https://codevetter.com/unpack/axios/extension-points

# Extension points — axios/axios

Scanned commit 56a5f1acdc41965f464eb59bec6cc828113ba546 (2026-09-16). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

The intended extension seams are well-marked. Adapters plug in through `knownAdapters` or by passing a function/array to `config.adapter`; `config.transport` overrides the Node transport wholesale; `config.env.{fetch,Request,Response,FormData,Blob}` lets a runtime inject its own primitives. Data shaping extends through `transformRequest`/`transformResponse` arrays, `paramsSerializer`, `formSerializer`, and `parseReviver`. Cross-cutting behavior extends through interceptors (with `synchronous` and `runWhen` modifiers) and through `AxiosHeaders.accessor()` for new header shorthands. New error codes are added as UPPER_SNAKE constants on `AxiosError`, new behavior flags as `transitional` keys validated in `Axios._request`.
- `config.adapter` accepts a name, a function, or an array of either; `getAdapter` resolves names against `knownAdapters` and accepts any function unchanged — that is the supported way to ship a custom adapter without touching the registry. — [lib/adapters/adapters.js#L52-L93](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/adapters/adapters.js#L52-L93) [lib/axios.js#L85](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/axios.js#L85)
- Adding an adapter to `knownAdapters` either as a function or as a `{get(config)}` capability-probe object is the registry-level seam; the `utils.forEach` loop then stamps `name`/`adapterName` onto it automatically for diagnostics. — [lib/adapters/adapters.js#L16-L36](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/adapters/adapters.js#L16-L36)
- `config.transport` short-circuits the Node transport selection before the `maxRedirects`/follow-redirects branches, letting callers supply any object with a `.request(options, cb)` — but such transports must enforce `maxBodyLength` themselves, since `transportEnforcesMaxBodyLength` stays false. — [lib/adapters/http.js#L1043-L1049](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/adapters/http.js#L1043-L1049) [lib/adapters/http.js#L1440-L1452](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/adapters/http.js#L1440-L1452)
- `config.env` is a first-class injection point: `getFetch(config)` memoizes a fetch adapter per `(Request, Response, fetch)` triple in a nested `Map` seed cache, and `defaults.env` carries `FormData`/`Blob` from the platform for `transformRequest` and `fromDataURI`. — [lib/adapters/fetch.js#L680-L712](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/adapters/fetch.js#L680-L712) [lib/defaults/index.js#L157-L160](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/defaults/index.js#L157-L160) [lib/adapters/http.js#L750-L755](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/adapters/http.js#L750-L755)
- `AxiosHeaders.accessor(header)` defines camel-cased `get*/set*/has*` shorthand methods on the prototype (with `__proto__: null` descriptors), and is how header conveniences like `getContentType`/`setContentLength` are added. — [lib/core/AxiosHeaders.js#L183-L196](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/core/AxiosHeaders.js#L183-L196) [lib/core/AxiosHeaders.js#L426-L440](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/core/AxiosHeaders.js#L426-L440)
- `methodList` is a frozen array that drives both the per-method default header buckets in `lib/defaults/index.js` and the header-bucket cleanup in `Axios._request` — adding a method means editing this one list. — [lib/core/methodList.js#L3-L16](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/core/methodList.js#L3-L16) [lib/defaults/index.js#L174-L176](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/defaults/index.js#L174-L176) [lib/core/Axios.js#L146-L154](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/core/Axios.js#L146-L154)
- New behavior flags plug into `lib/defaults/transitional.js` and must be added to the `validator.assertOptions(transitional, {...})` map in `Axios._request` — otherwise the option silently bypasses type validation. — [lib/defaults/transitional.js#L3-L10](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/defaults/transitional.js#L3-L10) [lib/core/Axios.js#L96-L110](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/core/Axios.js#L96-L110)
- `validator.validators` provides composable validators (`object`/`boolean`/`number`/`function`/`string`/`symbol`, plus `transitional(validator, version, message)` for deprecation warnings that print once and `spelling(correctSpelling)` used for `baseUrl`→`baseURL`), and is the sanctioned place to add config validation. — [lib/helpers/validator.js#L6-L60](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/helpers/validator.js#L6-L60) [lib/core/Axios.js#L131-L138](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/core/Axios.js#L131-L138)
- New error codes are added as UPPER_SNAKE static assignments at the bottom of `lib/core/AxiosError.js` (14 currently, from `ERR_BAD_OPTION_VALUE` to `ERR_FORM_DATA_DEPTH_EXCEEDED`); `AxiosError.from(error, code, config, request, response, customProps)` is the wrapper for third-party errors. — [lib/core/AxiosError.js#L201-L216](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/core/AxiosError.js#L201-L216) [lib/core/AxiosError.js#L76-L131](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/core/AxiosError.js#L76-L131)
- Serialization extends at three levels: `paramsSerializer` (function or `{encode, serialize}`), `config.formSerializer` (passed to `toFormData` with `visitor`/`dots`/`metaTokens`/`indexes`/`maxDepth`), and `parseReviver` on the response side. — [lib/core/Axios.js#L112-L129](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/core/Axios.js#L112-L129) [lib/defaults/index.js#L80-L99](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/defaults/index.js#L80-L99) [index.d.ts#L333-L338](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/index.d.ts#L333-L338)
- The Node adapter exports three internals for testing/extension — `__setProxy`, `__isNodeEnvProxyEnabled`, `__isSameOriginRedirect` — a deliberate seam for unit-testing proxy and redirect logic without a live socket. — [lib/adapters/http.js#L1488-L1490](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/adapters/http.js#L1488-L1490) [tests/unit/adapters/http.test.js](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/tests/unit/adapters/http.test.js)
- Platform swap points are `lib/platform/{node,browser}/classes/` (URLSearchParams, FormData, Blob, Buffer) and the `protocols` array — Node allows `['http','https','file','data']` while browser allows `['http','https','file','blob','url','data']`, and the Node adapter checks `supportedProtocols` derived from it. — [lib/platform/node/index.js](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/platform/node/index.js) [lib/platform/browser/index.js](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/platform/browser/index.js) [lib/adapters/http.js#L172-L178](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/adapters/http.js#L172-L178)
- Instance creation is itself an extension point: `instance.create(instanceConfig)` recursively calls `createInstance(mergeConfig(defaultConfig, instanceConfig))`, so scoped instances compose defaults rather than replacing them. — [lib/axios.js#L35-L40](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/lib/axios.js#L35-L40)
- Docs are extensible per-locale under `docs/<lang>/pages/advanced/*.md` (adapters, api-reference, cancellation, fetch-adapter, config-defaults, …) driven by the VitePress site, with a `test:search` node:test check on the search tokenizer. — [docs/package.json#L9-L15](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/docs/package.json#L9-L15) [docs/es/pages/advanced/adapters.md](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/docs/es/pages/advanced/adapters.md) [docs/es/pages/advanced/fetch-adapter.md](https://github.com/axios/axios/blob/56a5f1acdc41965f464eb59bec6cc828113ba546/docs/es/pages/advanced/fetch-adapter.md)

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)
