Reduce request configuration merge overhead while preserving prototype boundaries
mergeConfig runs once for axios(config) and twice for method aliases such as axios.post. On current v1.x (b8d67bbbd6b381e1f4b1887e32686fcc89c5b0a8), it rebuilds stateless strategies on each call, performs redundant prototype walks while recognizing plain objects, and repeatedly scans accumulated keys when merging headers without regard to case.
I have prepared a contribution covering those three costs, with regression tests for shared prototype boundaries and case-insensitive key handling. This issue records the scope before opening the PR, as requested by the contribution template.
The proposed changes preserve filtering of the exact unsafe names __proto__, constructor, and prototype, symbol-key identity, first-spelling/last-value header behavior, skipUndefined, and transitional validateStatus handling. Two internal observables will be called out in the PR: fewer calls to stateful Proxy traps and capture of Object.prototype.hasOwnProperty at module initialization.
Saved alternating-process measurements on Node 24.15.0 / Windows 11 / i5-12600KF show a typical request through a no-I/O adapter decreasing from 36.2 to 31.5 microseconds, and a header-heavy case from 259.6 to 186.3 microseconds. A separate verification run reproduced the direction and similar magnitude. These are local CPU-overhead measurements under shared machine load; they do not predict network latency improvements.
The saved full unit run reports 1,074 passing tests; the current pre-submission check reports 287 passing tests across eight relevant suites, including prototype-pollution and config-merging tests. Focused ESLint also passes.
Related history: #5606 and #5679 addressed duplicate key visits. This proposal targets different costs in the implementation that already includes that fix. Searches did not identify an equivalent open PR.
This contribution was developed and reviewed with AI assistance. The account owner authorized upstream submission.
Source: axios/axios