Skip to content
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

Add no-invalid-fetch-options rule #2338

Merged
merged 6 commits into from May 8, 2024

Conversation

fisker
Copy link
Collaborator

@fisker fisker commented May 8, 2024

Fixes #1989

@fisker fisker marked this pull request as ready for review May 8, 2024 09:26
@silverwind
Copy link
Contributor

silverwind commented May 8, 2024

Should add OPTIONS, TRACE and CONNECT:

Request has body: No

@fisker
Copy link
Collaborator Author

fisker commented May 8, 2024

These doesn't thows

fetch('/', {method: 'OPTIONS', body: 'foo'})
fetch('/', {method: 'TRACE', body: 'foo'})
fetch('/', {method: 'CONNECT', body: 'foo'})

The spec only forbids GET and HEAD.

@silverwind
Copy link
Contributor

These doesn't thows

fetch('/', {method: 'OPTIONS', body: 'foo'})
fetch('/', {method: 'TRACE', body: 'foo'})
fetch('/', {method: 'CONNECT', body: 'foo'})

The spec only forbids GET and HEAD.

Ok, then MDN is just inaccurate.

@sindresorhus sindresorhus merged commit 342aafb into sindresorhus:main May 8, 2024
14 of 16 checks passed
@fisker fisker deleted the no-invalid-fetch-options branch May 8, 2024 22:55
@GauBen
Copy link

GauBen commented May 10, 2024

Thanks @fisker!

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.

Rule proposal: force method: "POST" on fetch calls with body
4 participants