Repository navigation
fix: core methodList, HTTP adapter errors, and add tests - #11048
Closed
Mohammad-Faiz-Cloud-Engineer wants to merge 0 commit into
Closed
Mohammad-Faiz-Cloud-Engineer wants to merge 0 commit into
Mohammad-Faiz-Cloud-Engineer wants to merge 0 commit into
Conversation
Mohammad-Faiz-Cloud-Engineer
requested a review
from jasonsaayman
as a code owner
June 29, 2026 12:46
Contributor
There was a problem hiding this comment.
2 issues found across 5 files
Confidence score: 3/5
- In
lib/core/methodList.js, omittingpurge,link, andunlinkfrom the shared method list while Axios types/interfaces support them can cause runtime/type drift in method-based header/default handling, so those methods may behave inconsistently after merge — add the missing methods to keep runtime behavior aligned with the declared Axios method surface before merging. - In
lib/adapters/http.js, the new httpVersionAxiosErrorpaths drop the requestconfig, which makes these failures harder to diagnose and less consistent with other adapter errors; merging as-is risks poorer debugging and error handling in production — includeconfigon these errors to match existing AxiosError conventions before merging.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes the supported HTTP method list in lib/core/, uses it to keep header defaults/flattening consistent, normalizes Node HTTP adapter option-validation failures to AxiosError, and fixes mergeConfig to correctly merge timeoutErrorMessage overrides.
Changes:
- Added
lib/core/methodList.jsand reused it for header flattening (lib/core/Axios.js) anddefaults.headers[method]initialization (lib/defaults/index.js). - Updated
lib/adapters/http.jsto throwAxiosError(withERR_BAD_OPTION_VALUE) for invalidaddress/httpVersionand to includeconfiginhttpVersionvalidation errors. - Fixed
mergeConfigto mergetimeoutErrorMessage(and added focused unit tests for these behaviors).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/core/mergeConfig.test.js | Adds assertions that timeoutErrorMessage merges/overrides correctly. |
| tests/unit/axios.test.js | Adds a unit check that defaults.headers[method] exists and is {} for every method in methodList. |
| tests/unit/adapters/http.test.js | Adds coverage that invalid address and httpVersion reject with AxiosError + ERR_BAD_OPTION_VALUE. |
| lib/defaults/index.js | Initializes defaults.headers[method] via the centralized methodList. |
| lib/core/methodList.js | Introduces a single source of truth for supported methods (including purge/link/unlink). |
| lib/core/mergeConfig.js | Fixes merge map key to timeoutErrorMessage. |
| lib/core/Axios.js | Uses methodList when removing method-specific header buckets during header flattening. |
| lib/adapters/http.js | Replaces raw TypeError option-validation throws with AxiosError and passes config for httpVersion errors. |
Contributor
Author
|
hey i accidently closed my pr i will reopen it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lib/core/methodList.jsand use it in:lib/core/Axios.jsfor supported method header flattening.lib/defaults/index.jsto initializedefaults.headers[method]from the shared method list.purge,link,unlinkto methodList to align withMethodtype andHeadersDefaultsinterface.TypeErrorinstances withAxiosError.configargument to httpVersionAxiosErrorthrows for consistency with other adapter errors.timeoutMessagetypo inmergeConfig.defaults.headers[method]existing for all entries in methodList.addressandhttpVersionrejecting withAxiosErrorcodeERR_BAD_OPTION_VALUE.mergeConfigpreservingtimeoutErrorMessagefrom overrides.Summary by cubic
Centralizes the HTTP method list in core, normalizes HTTP adapter option errors to
AxiosError, and fixesmergeConfigto honortimeoutErrorMessage. Adds tests to lock these behaviors.Changes
lib/core/methodList.js; used inAxiosheader flattening anddefaults.headersinit.options,purge,link,unlink,query.TypeErrorwithAxiosError('ERR_BAD_OPTION_VALUE')for invalidaddressandhttpVersion; passedconfigforhttpVersion.mergeConfigto usetimeoutErrorMessage.Notes
/docs/to list supported methods, showtimeoutErrorMessage, and note adapter validation forhttpVersion/addresswithERR_BAD_OPTION_VALUE.defaults.headers[method]permethodList, HTTP adapter option errors, andmergeConfighonoringtimeoutErrorMessage.Written for commit cb4fd74. Summary will update on new commits.