Skip to content

fix(ext/fetch): only uppercase known methods #30290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

0f-0b
Copy link
Contributor

@0f-0b 0f-0b commented Aug 1, 2025

Closes #30288.

@mitranim Please take a look to see if this is the correct fix.

@mitranim
Copy link

mitranim commented Aug 2, 2025

Seems reasonable to me! And the addition of the null prototype for known methods is a good additional change.

@@ -222,7 +221,6 @@ const KNOWN_METHODS = {
"OPTIONS": "OPTIONS",
"options": "OPTIONS",
"PATCH": "PATCH",
"patch": "PATCH",
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason to remove this one?

Copy link

@mitranim mitranim Aug 6, 2025

Choose a reason for hiding this comment

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

Yes. Without this change, patch would be converted to PATCH in the "fast case" of method normalization. PATCH is not on the list of methods which the fetch standard says should be normalized via uppercase. HTTP methods are case-sensitive, and patch and PATCH are not the same. You can test this by using fetch in Chrome.

@0f-0b 0f-0b force-pushed the normalize-method branch from b866a4a to 4c80cfd Compare August 7, 2025 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fetch incorrectly uppercases all HTTP methods
3 participants