Skip to content

feat(HttpStatusCode): add RFC 9110 aliases for 413 and 422 - #11082

Merged
jasonsaayman merged 3 commits into
axios:v1.xfrom
Hashim1999164:fix/rfc9110-status-code-aliases-11066
Aug 4, 2026
Merged

jasonsaayman merged 3 commits into
axios:v1.xfrom
Hashim1999164:fix/rfc9110-status-code-aliases-11066

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add ContentTooLarge (413) and UnprocessableContent (422) to HttpStatusCode in JS and TypeScript definitions.
  • Keep PayloadTooLarge and UnprocessableEntity as backward-compatible aliases marked @deprecated with a pointer to the RFC 9110 names.
  • Extend unit tests to cover alias values and reverse lookups (413 → ContentTooLarge, 422 → UnprocessableContent).

Closes #11066

Test plan

  • npx vitest run tests/unit/helpers/HttpStatusCode.test.js

Summary by cubic

Adds RFC 9110 names ContentTooLarge (413) and UnprocessableContent (422) to HttpStatusCode. Keeps legacy names as deprecated aliases and preserves v1.x numeric reverse lookups to the legacy strings.

Description

  • Summary of changes

    • Added ContentTooLarge (413) and UnprocessableContent (422) in runtime and in index.d.ts/index.d.cts.
    • Marked PayloadTooLarge and UnprocessableEntity as @deprecated aliases.
    • Kept numeric reverse lookups returning legacy names (e.g., HttpStatusCode[413] === 'PayloadTooLarge').
    • Extended tests for both aliases and legacy reverse lookups; added ESM/CJS type references.
  • Reasoning

    • Aligns names with RFC 9110 while maintaining backward compatibility in v1.x.
  • Additional context

    • No runtime behavior changes beyond adding aliases and keeping reverse mapping stable for v1.x.

Docs

  • Update /docs/ to prefer ContentTooLarge and UnprocessableContent in examples.
  • Note deprecations and that numeric reverse lookups still return legacy names in v1.x.

Testing

  • Added a unit test to verify both aliases and that reverse lookups return legacy names.
  • Added ESM and CJS type tests referencing the new enum members.

Semantic version impact

  • Minor: adds new enum members and deprecates old names without breaking existing code.

Written for commit a76fa42. Summary will update on new commits.

Review in cubic

Keep PayloadTooLarge and UnprocessableEntity as deprecated aliases so existing code keeps working.

@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.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

Copilot AI 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.

Pull request overview

🏄 This PR updates axios’s exported HttpStatusCode map/types to align the 413 and 422 status names with RFC 9110 while preserving backward compatibility via deprecated aliases, and ensures reverse lookups prefer the RFC names.

Changes:

  • Added ContentTooLarge (413) and UnprocessableContent (422) alongside existing names.
  • Marked PayloadTooLarge and UnprocessableEntity as deprecated aliases (JS JSDoc + TS declaration comments).
  • Extended unit tests to validate forward aliases and reverse lookups (HttpStatusCode[413], HttpStatusCode[422]).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
lib/helpers/HttpStatusCode.js Adds RFC 9110 alias properties and ensures reverse lookup prefers the RFC names via insertion order.
index.d.ts Updates the public TS HttpStatusCode enum to include RFC names and deprecate old aliases.
index.d.cts Mirrors the enum updates for the CJS typings.
tests/unit/helpers/HttpStatusCode.test.js Adds coverage for alias values and reverse-lookup preference for 413/422.

@jasonsaayman jasonsaayman added the commit::feat The PR is related to a feature label Jul 29, 2026
@jasonsaayman jasonsaayman changed the title Add RFC 9110 aliases for 413 and 422 HttpStatusCode names feat(HttpStatusCode): add RFC 9110 aliases for 413 and 422 Aug 4, 2026

@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.

1 issue found across 6 files (changes from recent commits).

Confidence score: 5/5

  • In lib/helpers/HttpStatusCode.js, canonical status-name selection is currently order-dependent, so a future reordering of legacy vs RFC 9110 aliases could silently change mappings like 413/422 and cause inconsistent labels for downstream consumers — add an explicit canonical-name map (or targeted regression tests) to remove declaration-order coupling.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="lib/helpers/HttpStatusCode.js">

<violation number="1" location="lib/helpers/HttpStatusCode.js:83">
P3: The first-wins guard correctly preserves `HttpStatusCode[413] === 'PayloadTooLarge'` and `HttpStatusCode[422] === 'UnprocessableEntity'`, but only because the legacy keys happen to be declared before their RFC 9110 counterparts in the literal. That keeps reverse-lookup results silently coupled to the declaration order of the alias pairs. If a future alias pair is added with the legacy key placed after the RFC name, or the literal gets reordered, reverse lookups would quietly change with no signature in this loop that anything was intended. Consider making the intent explicit — for example a short comment on this loop noting that legacy names are intentionally declared first to win reverse lookups, or an explicit reverse-map constant — so the coupling is documented rather than implicit.</violation>
</file>

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

Re-trigger cubic


Object.entries(HttpStatusCode).forEach(([key, value]) => {
HttpStatusCode[value] = key;
if (HttpStatusCode[value] === undefined) {

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.

P3: The first-wins guard correctly preserves HttpStatusCode[413] === 'PayloadTooLarge' and HttpStatusCode[422] === 'UnprocessableEntity', but only because the legacy keys happen to be declared before their RFC 9110 counterparts in the literal. That keeps reverse-lookup results silently coupled to the declaration order of the alias pairs. If a future alias pair is added with the legacy key placed after the RFC name, or the literal gets reordered, reverse lookups would quietly change with no signature in this loop that anything was intended. Consider making the intent explicit — for example a short comment on this loop noting that legacy names are intentionally declared first to win reverse lookups, or an explicit reverse-map constant — so the coupling is documented rather than implicit.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lib/helpers/HttpStatusCode.js, line 83:

<comment>The first-wins guard correctly preserves `HttpStatusCode[413] === 'PayloadTooLarge'` and `HttpStatusCode[422] === 'UnprocessableEntity'`, but only because the legacy keys happen to be declared before their RFC 9110 counterparts in the literal. That keeps reverse-lookup results silently coupled to the declaration order of the alias pairs. If a future alias pair is added with the legacy key placed after the RFC name, or the literal gets reordered, reverse lookups would quietly change with no signature in this loop that anything was intended. Consider making the intent explicit — for example a short comment on this loop noting that legacy names are intentionally declared first to win reverse lookups, or an explicit reverse-map constant — so the coupling is documented rather than implicit.</comment>

<file context>
@@ -80,7 +80,9 @@ const HttpStatusCode = {
 
 Object.entries(HttpStatusCode).forEach(([key, value]) => {
-  HttpStatusCode[value] = key;
+  if (HttpStatusCode[value] === undefined) {
+    HttpStatusCode[value] = key;
+  }
</file context>

@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds the RFC 9110 names ContentTooLarge for HTTP 413 and UnprocessableContent for HTTP 422 while preserving the existing v1-compatible aliases and numeric reverse lookups.

Package-consumer validation exercised ESM and CommonJS runtime imports plus TypeScript compilation for both declaration entry points. It confirmed both new aliases resolve to their expected status codes and numeric lookups continue returning PayloadTooLarge for 413 and UnprocessableEntity for 422. The executed pre-change comparison returned ContentTooLarge for the 413 reverse lookup, while the PR head returned the established legacy name.

Confidence Score: 5/5

T-Rex T-Rex Logs

What T-Rex did

  • I ran trex-artifacts/http-status-alias-package-consumer.mjs against linked package consumers importing axios through ESM and CommonJS entry points, asserted both 413 and 422 aliases, verified the legacy numeric reverse mappings, and compiled ESM and CommonJS TypeScript consumers; the PR-head run completed with exit code 0 and all runtime assertions passed, while the pre-change run failed because the 413 reverse lookup returned ContentTooLarge, showing the fix was needed.
  • I authored and executed the script trex-artifacts/http-status-alias-package-consumer.mjs to create a temporary package consumer, linked it to the repository package, import axios via ESM and CJS entry points, perform checks that ContentTooLarge equals PayloadTooLarge equals 413 and UnprocessableContent equals UnprocessableEntity equals 422, and then compiled ESM and CJS TypeScript consumers; the checks all passed with exit code 0, confirming the intended compatibility fix and distinguishing it from the pre-change failure.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix(HttpStatusCode): preserve v1 reverse..." | Re-trigger Greptile

@jasonsaayman
jasonsaayman merged commit 39955a6 into axios:v1.x Aug 4, 2026
27 checks passed
markharding pushed a commit to futo-org/Harbor that referenced this pull request Oct 16, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [axios](https://axios-http.com) ([source](https://github.com/axios/axios)) | [`1.18.1` → `1.20.0`](https://renovatebot.com/diffs/npm/axios/1.18.1/1.20.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/axios/1.20.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/axios/1.18.1/1.20.0?slim=true) |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/99) for more information.

---

### Release Notes

<details>
<summary>axios/axios (axios)</summary>

### [`v1.20.0`](https://github.com/axios/axios/releases/tag/v1.20.0)

[Compare Source](axios/axios@v1.19.0...v1.20.0)

#### v1.20.0 — August 19, 2026

This release hardens runtime option handling, adds RFC 9110 status-code aliases, fixes Node.js and XHR reliability issues, and refreshes project tooling and documentation.

#### ⚠️ Breaking Changes & Deprecations

- HTTP Status Naming: Added ContentTooLarge (413) and UnprocessableContent (422), while retaining PayloadTooLarge and UnprocessableEntity as backward-compatible deprecated aliases. ([#&#8203;11082](axios/axios#11082))

#### 🔒 Security Fixes

- Runtime Option Handling: Hardened behavioral configuration reads against shared and foreign prototype pollution and normalized unsafe interceptor replacement objects. This also clarifies Fetch redirect and custom implementation behavior, HTTP/2 DNS and proxy handling, CIDR-based NO_PROXY matching, and malformed data URI rejection; see the PR for documented compatibility effects. ([#&#8203;11141](axios/axios#11141))

#### 🐛 Bug Fixes

- Interceptor Lifecycle: Prevented unbounded handler-array growth by trimming trailing ejected interceptors without changing iteration semantics, and kept interceptor operations safe when the public handlers field is nullish. ([#&#8203;11087](axios/axios#11087), [#&#8203;11118](axios/axios#11118))
- Request Error Preservation: Prevented custom Error.prepareStackTrace implementations that return non-string values from replacing the original request failure with an unrelated TypeError. ([#&#8203;11109](axios/axios#11109))
- XHR Reliability: Navigation-canceled requests now reject with ECONNABORTED instead of resolving with status 0, while successful downloads flush their final progress callback during the live loadend dispatch. ([#&#8203;11094](axios/axios#11094), [#&#8203;11121](axios/axios#11121))
- Node.js Socket Memory: Removed request-context retention from per-socket error listeners, preventing completed response data from being pinned for the lifetime of pooled keep-alive sockets. ([#&#8203;11091](axios/axios#11091))
- Core Methods and HTTP Errors: Prevented structural method-header buckets from leaking into outgoing headers, standardized invalid DNS lookup and httpVersion failures as AxiosError.ERR_BAD_OPTION_VALUE, and corrected the timeoutErrorMessage merge strategy. ([#&#8203;11096](axios/axios#11096))

#### 🔧 Maintenance & Chores

- Dependencies: Updated fast-uri, postcss, js-yaml, mocha, development-tooling groups, and GitHub Actions dependencies. ([#&#8203;11092](axios/axios#11092), [#&#8203;11098](axios/axios#11098), [#&#8203;11099](axios/axios#11099), [#&#8203;11106](axios/axios#11106), [#&#8203;11107](axios/axios#11107), [#&#8203;11122](axios/axios#11122), [#&#8203;11123](axios/axios#11123), [#&#8203;11126](axios/axios#11126), [#&#8203;11127](axios/axios#11127), [#&#8203;11133](axios/axios#11133), [#&#8203;11140](axios/axios#11140), [#&#8203;11143](axios/axios#11143), [#&#8203;11144](axios/axios#11144))
- Documentation: Applied the v1.19.0 documentation updates, added the missing fs import to the README stream example, introduced localized global search, and repaired the interceptor test link. ([#&#8203;11101](axios/axios#11101), [#&#8203;11113](axios/axios#11113), [#&#8203;11097](axios/axios#11097), [#&#8203;11119](axios/axios#11119))
- Sponsorship: Updated sponsorship links and data and added ScrapingBee as a sponsor. ([#&#8203;11124](axios/axios#11124), [#&#8203;11136](axios/axios#11136), [#&#8203;11137](axios/axios#11137))
- CI and Release: Switched ESM smoke tests to locked dependencies and synchronized package and runtime version metadata for v1.20.0. ([#&#8203;11128](axios/axios#11128), [#&#8203;11152](axios/axios#11152))

#### 🌟 New Contributors

We are thrilled to welcome our new contributors. Thank you for helping improve axios:

- [@&#8203;yens1](https://github.com/yens1) ([#&#8203;11109](axios/axios#11109))
- [@&#8203;Sasireddy001](https://github.com/Sasireddy001) ([#&#8203;11113](axios/axios#11113))
- [@&#8203;ari-token-security](https://github.com/ari-token-security) ([#&#8203;11094](axios/axios#11094))
- [@&#8203;timothyokooboh](https://github.com/timothyokooboh) ([#&#8203;11097](axios/axios#11097))
- [@&#8203;gi9439041-png](https://github.com/gi9439041-png) ([#&#8203;11119](axios/axios#11119))
- [@&#8203;Hashim1999164](https://github.com/Hashim1999164) ([#&#8203;11082](axios/axios#11082))
- [@&#8203;v-dev-cl](https://github.com/v-dev-cl) ([#&#8203;11091](axios/axios#11091))
- [@&#8203;r0h1tb](https://github.com/r0h1tb) ([#&#8203;11118](axios/axios#11118))
- [@&#8203;ostapondo](https://github.com/ostapondo) ([#&#8203;11121](axios/axios#11121))

Full Changelog (<axios/axios@v1.19.0...v1.20.0>)

### [`v1.19.0`](https://github.com/axios/axios/blob/HEAD/CHANGELOG.md#v1190--July-22-2026)

[Compare Source](axios/axios@v1.18.1...v1.19.0)

This release raises the form-data security floor, adds configuration and type-system capabilities, and fixes NO_PROXY matching, interceptor errors, progress reporting, and serialization edge cases.

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - "before 9am on tuesday"
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE2NC41IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->

Reviewed-on: https://code.futo.org/harbor/harbor/pulls/1808
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::feat The PR is related to a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

proposal: align 413 naming with RFC 9110 (PayloadTooLarge → ContentTooLarge)

5 participants