Skip to content

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

Merged
bartlomieju merged 3 commits into
denoland:mainfrom
0f-0b:normalize-method
Sep 3, 2025
Merged

bartlomieju merged 3 commits into
denoland:mainfrom
0f-0b:normalize-method

Conversation

@0f-0b

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

Copy link
Copy Markdown
Contributor

Closes #30288.

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

@mitranim

mitranim commented Aug 2, 2025 •

Copy link
Copy Markdown

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

Comment thread ext/fetch/23_request.js
"OPTIONS": "OPTIONS",
"options": "OPTIONS",
"PATCH": "PATCH",
"patch": "PATCH",

Copy link
Copy Markdown
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?

@mitranim mitranim Aug 6, 2025 •

Copy link
Copy Markdown

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
@bartlomieju bartlomieju added this to the 2.5.0 milestone Sep 2, 2025
@bartlomieju

Copy link
Copy Markdown
Member

@0f-0b could you please take another look? Looks like a Node test is now failing because of this change

@0f-0b

0f-0b commented Sep 2, 2025

Copy link
Copy Markdown
Contributor Author

Looks like a Node test is now failing because of this change

I don't see the error when running the tests locally. Could you perhaps rerun CI?

@bartlomieju bartlomieju left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

@bartlomieju
bartlomieju merged commit a97ff6d into denoland:main Sep 3, 2025
@0f-0b
0f-0b deleted the normalize-method branch September 3, 2025 17:39
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