Skip to content

Add types to fetch methods #1957

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

Closed
Bashamega opened this issue Apr 1, 2025 · 5 comments
Closed

Add types to fetch methods #1957

Bashamega opened this issue Apr 1, 2025 · 5 comments

Comments

@Bashamega
Copy link
Contributor

Currently, the fetch method is a string, but not all values are valid. We should specify the allowed HTTP methods.
Reference: MDN - HTTP Methods.
I can create a PR for this, but we need a way to handle case insensitivity when checking the method.

@HolgerJeromin
Copy link
Contributor

HolgerJeromin commented Apr 1, 2025

You are talking about https://developer.mozilla.org/en-US/docs/Web/API/Request/method ?

Currently, the fetch method is a string, but not all values are valid.

yes they are.

fetch('https://github.com/wow', {method: 'HOLGER'}).catch(data => console.error(data)).then(data => console.log(data))
is valid IMO for the web platform, used for example in webDAV.

@Bashamega
Copy link
Contributor Author

You are talking about https://developer.mozilla.org/en-US/docs/Web/API/Request/method ?

Currently, the fetch method is a string, but not all values are valid.

yes they are.

fetch('https://github.com/wow', {method: 'HOLGER'}).catch(data => console.error(data)).then(data => console.log(data)) is valid IMO for the web platform, used for example in webDAV.

But at least the standards will be available. But I understand your point.

@HolgerJeromin
Copy link
Contributor

We would have to merge all "well known" standards at this point. And if a customer wants to extend this list he had to circumvent typescript a bit.

But we had an issue here in this repo for adding some well known string values for intellisense while keeping string for the rest.
Perhaps @saschanaz can remember where we had this...

@Bashamega
Copy link
Contributor Author

This is what i mean for intellisense

@HolgerJeromin
Copy link
Contributor

ref #1467 (comment)

@Bashamega Bashamega closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2025
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

No branches or pull requests

2 participants