-
Notifications
You must be signed in to change notification settings - Fork 290
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
Remove Fetcher methods get(), put(), delete() with compat flag. #1770
Conversation
These were intended to be convenient wrappers around `fetch()` that perform the respective HTTP method. It was a bad idea (my fault). Luckily it was never documented and probably few people depend on it. Note that a long time ago, KV namespace bindings were Fetchers rather than being the specific KvNamespace type. This had lots of problems, but sort of worked as long as your key names were URL-safe. It's possible very old scripts are in production that still depend on these old-style bindings, but they won't be broken since they obviously have ancient compat dates as well. (In fact... they predate compat dates...)
@@ -12,13 +12,21 @@ export class DurableObjectExample { | |||
foo() { | |||
return 123; | |||
} | |||
|
|||
fetch(req) { | |||
return new Response(req.method + " " + req.url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return new Response(req.method + " " + req.url); | |
return new Response(`${req.method} ${req.url}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that's an improvement. Don't think it's worth restarting CI, though.
This is actually a pretty cool idea and TIL it existed! Very similar to Pages Functions. |
As implemented in: cloudflare/workerd#1770
The "linux" build seems to have hung on mksnapshot, but "linux-debug" passed and all internal builds passed, and GitHub apparently cannot cancel the hung workflow, it's just gonna run until it times out or something. I'm just going to merge. |
* Document compat flag: fetcher_no_get_put_delete As implemented in: cloudflare/workerd#1770 * Update content/workers/_partials/_platform-compatibility-dates/fetcher-no-get-put-delete.md * Apply suggestions from code review Co-authored-by: Brendan Irvine-Broque <[email protected]> --------- Co-authored-by: Brendan Irvine-Broque <[email protected]>
These were intended to be convenient wrappers around
fetch()
that perform the respective HTTP method. It was a bad idea (my fault). Luckily it was never documented and probably few people depend on it.Note that a long time ago, KV namespace bindings were Fetchers rather than being the specific KvNamespace type. This had lots of problems, but sort of worked as long as your key names were URL-safe. It's possible very old scripts are in production that still depend on these old-style bindings, but they won't be broken since they obviously have ancient compat dates as well. (In fact... they predate compat dates...)