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 PATCH to valid XHR types #5279

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@uppy/xhr-upload/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface XHRUploadOptions extends PluginOptions {
timeout?: number
responseUrlFieldName?: string
endpoint: string
method?: 'GET' | 'POST' | 'PUT' | 'HEAD' | 'get' | 'post' | 'put' | 'head'
method?: 'GET' | 'POST' | 'PUT' | 'HEAD' | 'PATCH' | 'get' | 'post' | 'put' | 'head' | 'patch'
Copy link
Contributor

@aduh95 aduh95 Jun 27, 2024

Choose a reason for hiding this comment

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

IMO we should defined all the methods listed in https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods, plus all the lowercase version of the standard ones, minus the ones that would send a SecurityError. As discussed in the previous issue, lowercase patch is not valid, and only supported on 3.x for backward-compatibility.

Suggested change
method?: 'GET' | 'POST' | 'PUT' | 'HEAD' | 'PATCH' | 'get' | 'post' | 'put' | 'head' | 'patch'
method?:
| 'GET'
| 'HEAD'
| 'POST'
| 'PUT'
| 'DELETE'
| 'OPTIONS'
| 'PATCH'
| 'delete'
| 'get'
| 'head'
| 'options'
| 'post'
| 'put'
| string

Could you also update the type in the source file please? Currently it is lacking quite a bunch of valid types:

method?: 'post' | 'put'

locale?: XHRUploadLocale
responseType?: string
withCredentials?: boolean
Expand Down