wrangler 4.29.1 → 4.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,40 +0,0 @@
1
- export default {
2
- async fetch(request, env) {
3
- const targetBinding = request.headers.get("MF-Binding");
4
-
5
- if (targetBinding) {
6
- const originalHeaders = new Headers();
7
- for (const [name, value] of request.headers) {
8
- if (name.startsWith("mf-header-")) {
9
- originalHeaders.set(name.slice("mf-header-".length), value);
10
- } else if (name === "upgrade") {
11
- // The `Upgrade` header needs to be special-cased to prevent:
12
- // TypeError: Worker tried to return a WebSocket in a response to a request which did not contain the header "Upgrade: websocket"
13
- originalHeaders.set(name, value);
14
- }
15
- }
16
- let fetcher = env[targetBinding];
17
-
18
- // Special case the Dispatch Namespace binding because it has a top-level synchronous .get() call
19
- const dispatchNamespaceOptions = originalHeaders.get(
20
- "MF-Dispatch-Namespace-Options"
21
- );
22
- if (dispatchNamespaceOptions) {
23
- const { name, args, options } = JSON.parse(dispatchNamespaceOptions);
24
- fetcher = (env[targetBinding] as DispatchNamespace).get(
25
- name,
26
- args,
27
- options
28
- );
29
- }
30
- return (fetcher as Fetcher).fetch(
31
- request.headers.get("MF-URL")!,
32
- new Request(request, {
33
- redirect: "manual",
34
- headers: originalHeaders,
35
- })
36
- );
37
- }
38
- return new Response("Provide a binding", { status: 400 });
39
- },
40
- } satisfies ExportedHandler<Record<string, Fetcher | DispatchNamespace>>;