fix: add missing OPTIONS header support, extract shared method list, fix zh docs by Mohammad-Faiz-Cloud-Engineer · Pull Request #11022 · axios/axios · GitHub
Skip to content

fix: add missing OPTIONS header support, extract shared method list, fix zh docs#11022

Open
Mohammad-Faiz-Cloud-Engineer wants to merge 6 commits into
axios:v1.xfrom
Mohammad-Faiz-Cloud-Engineer:v1.x
Open

fix: add missing OPTIONS header support, extract shared method list, fix zh docs#11022
Mohammad-Faiz-Cloud-Engineer wants to merge 6 commits into
axios:v1.xfrom
Mohammad-Faiz-Cloud-Engineer:v1.x

Conversation

@Mohammad-Faiz-Cloud-Engineer

@Mohammad-Faiz-Cloud-Engineer Mohammad-Faiz-Cloud-Engineer commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Added 'options' to the per-method header init and flattening loops so it works like every other HTTP method. Also extracted the shared method list into lib/core/methodList.js so these two lists can't drift apart again.

Fixed a typo in mergeConfig timeoutMessage → timeoutErrorMessage which was silently dropping the option.

Replaced three raw TypeError throws in the Node adapter with proper AxiosError(ERR_BAD_OPTION_VALUE).

Fixed malformed VitePress frontmatter in docs/zh/index.md (heading before the block, HTML comment inside YAML, de-indented features list) and removed a duplicate from docs/zh/pages/misc/sponsors.md.

Lockfile regenerated from npm install.

Summary

Commit 856621f — Docs formatting

  • CLAUDE.md: Added # Claude Instructions header
  • MIGRATION_GUIDE.md: Markdown fixes (trailing whitespace, table alignment, section headers)
  • THREATMODEL.md: Full markdown reformatting (328 lines)
  • docs/index.md: Markdown fixes
  • docs/zh/index.md: Partial markdown fixes (later fully fixed in c7b259e)
  • docs/zh/pages/advanced/create-an-instance.md: 1-line fix
  • docs/zh/pages/advanced/error-handling.md: Markdown fixes (44 lines)
  • docs/zh/pages/getting-started/first-steps.md: Markdown fixes
  • docs/zh/pages/misc/sponsors.md: Partial fix (later fully fixed in c7b259e)

Commit 261b5d9 — Lockfile

  • package-lock.json: Regenerated via npm install (704 insertions, 778 deletions)

Commit 5e62a1e — TypeError + timeoutMessage

  • lib/adapters/http.js: 3 raw TypeError → AxiosError(ERR_BAD_OPTION_VALUE) for invalid address, httpVersion parsing, unsupported httpVersion
  • lib/core/mergeConfig.js: timeoutMessage → timeoutErrorMessage

Commit aa1af4f — OPTIONS method

  • lib/core/Axios.js: Added 'options' to header flattening loop
  • lib/defaults/index.js: Added 'options' to per-method header init loop

Commit c7b259e — Shared methodList + zh docs fix

  • lib/core/methodList.js: New shared constant (8 methods)
  • lib/core/Axios.js: Imports methodList, uses [...methodList, 'common']
  • lib/defaults/index.js: Imports methodList, uses it directly
  • docs/zh/index.md: Removed heading before frontmatter, moved HTML comment out of YAML, fixed features list indentation
  • docs/zh/pages/misc/sponsors.md: Removed duplicate # 赞助商 heading

The OPTIONS HTTP method had a runtime alias (Axios.prototype.options)
and a TypeScript type declaration (HeadersDefaults.options) but was
missing from the header defaults initialization and the header
flattening loop. This caused per-method default headers set via
axios.defaults.headers.options to be silently dropped during request
dispatch, inconsistent with every other HTTP method.

- lib/core/Axios.js: add 'options' to the method header delete list
- lib/defaults/index.js: add 'options' to per-method header init
@socket-security

socket-security Bot commented Jun 17, 2026

Copy link
Copy Markdown

@socket-security

socket-security Bot commented Jun 17, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Medium
Low adoption: npm @humanfs/types

Location: Package overview

From: package-lock.jsonnpm/eslint@10.5.0npm/@humanfs/types@0.15.0

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@humanfs/types@0.15.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 14 files

Confidence score: 3/5

  • docs/zh/index.md has malformed VitePress frontmatter (content before the block, invalid YAML comment style, and de-indented features), which can break metadata parsing and cause the page to render incorrectly or fail doc builds — fix the frontmatter structure and YAML formatting before merging.
  • lib/defaults/index.js duplicates the method list from lib/core/Axios.js:153, and this has already led to an options omission regression; merging as-is keeps a silent drift path for future behavior mismatches — extract the method list to a shared constant and reference it from both places.
  • docs/zh/pages/misc/sponsors.md now has both a Markdown # heading and an in-template <h1>, which produces two top-level headings and can hurt document structure/accessibility — keep only one H1 source before merging.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread docs/zh/index.md Outdated
Comment thread lib/defaults/index.js Outdated
Comment thread docs/zh/pages/misc/sponsors.md Outdated
@Mohammad-Faiz-Cloud-Engineer

Copy link
Copy Markdown
Contributor Author

@Mohammad-Faiz-Cloud-Engineer Mohammad-Faiz-Cloud-Engineer changed the title fix: add missing OPTIONS method header support, correct timeoutErrorMessage typo, and replace raw TypeErrors with AxiosError fix: add missing OPTIONS header support, extract shared method list, fix zh docs Jun 17, 2026
@jasonsaayman jasonsaayman added the commit::fix The PR is related to a bugfix label Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::fix The PR is related to a bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants