-
Notifications
You must be signed in to change notification settings - Fork 556
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
404 File Not Found uWebSockets/20 Server on PATCH #1061
Comments
I can serve a PATCH request here, can you provide a small snippet that fails? |
|
Hi, turns out the problem is in my test code, not in uWebSockets.js. The cause is Node.js internal fetch (undici) doesn't normalize Thread here: nodejs/undici#2294 The fix in my code: const url = new URL("http://localhost:8080/");
url.pathname = `/api/${resource}/${item.id}`;
- const method = "patch";
+ const method = "PATCH";
const headers = new Headers();
if (typeof token === "string") {
headers.set("authorization", `Bearer ${token}`);
}
headers.set("content-type", "application/json; charset=utf-8");
const body = JSON.stringify(item);
const response = await fetch(url, { method, headers, body }); Closing this, thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi everyone good day.
Has anyone encountered unbound handlers on PATCH method that redirects to 404 recently?
I'm generating CRUD endpoints for my tables. The following methods work:
The problem is I also want to support PATCH handler because my PUT handler supports partial column updates. But when I try to bind it to PATCH handler, it doesn't get caught, and ends up to the default 404 handler.
I am using
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.43.0"
When I remove the codes that use PATCH, all tests work:
For now I"ll be using PUT, but decided to create this issue in case someone else encounters similar issue, thank you.
The text was updated successfully, but these errors were encountered: