-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Latest version of @uppy/xhr-upload doesn't support PATCH method #5165
Comments
Hi, we can change it to simply |
BTW unless you are on the 4.0 beta version, you should still have the old types:
Are you on the beta version? |
Hi @Murderlon - thanks for your quick reply! I am on the latest released version so it probably is the list of types you indicate here, but that list still doesn't include PATCH. Can I use @ts-expect-error in my code that calls this? My code is JS and not TS so I'm not sure how to add this line - is it in a comment somewhere? |
If you're not using TS, it doesn't matter to you what the types are, you wouldn't get an error regardless of what you pass. What error are you seeing then? |
@Murderlon There's no error - the HTTP request gets initiated but with no method set at all, which causes the server to complain that it's received a malformed request. But in trying to get you screenshots I've now discovered that the TS version works up to version 3.6.4 so I guess it's not TS that's the problem but some other underlying cause. Here's what the request looks like using version 3.6.4: and here's what it looks like when using 3.6.5/3.6.6 (I changed no other packages in package.json except @uppy/xhr-upload): |
That looks like a regression indeed. I can take a look. |
Thanks so much! A couple more datapoints from my investigation if they're helpful:
|
Furthermore, I've discovered that if I name the method |
I was just going to say I can confirm with a test that it works. PR welcome to update types & docs :) |
Thanks! I don't know enough about TS to make a change to the types in the code but happy to submit a PR to update the docs. |
IMO we should fix the regression. |
Initial checklist
Link to runnable example
https://github.com/fishpercolator/name.pn/blob/main/app/javascript/controllers/likeness_uploader_controller.js
Steps to reproduce
This bug has been introduced by the change to TypeScript, which now enforces that
method
can only be 'put' or 'post':uppy/packages/@uppy/xhr-upload/src/index.ts
Line 46 in 86e2e67
Is it possible to return to supporting all HTTP methods here? Unfortunately, this has broken my app in development, since my endpoint expects the method to be PATCH.
Thanks so much for understanding and for looking into this. I'm afraid I don't know enough TS to be able to submit a PR myself.
Expected behavior
The XHR request is initiated with a method of PATCH
Actual behavior
The XHR request is initiated with no method set at all, which results in the webserver interpreting it as a malformed HTTP request
The text was updated successfully, but these errors were encountered: