this repo has no description
1const urls = new Set();
2
3function checkURL(request, init) {
4 const url =
5 request instanceof URL
6 ? request
7 : new URL(
8 (typeof request === "string"
9 ? new Request(request, init)
10 : request
11 ).url
12 );
13 if (url.port && url.port !== "443" && url.protocol === "https:") {
14 if (!urls.has(url.toString())) {
15 urls.add(url.toString());
16 console.warn(
17 `WARNING: known issue with \`fetch()\` requests to custom HTTPS ports in published Workers:\n` +
18 ` - ${url.toString()} - the custom port will be ignored when the Worker is published using the \`wrangler deploy\` command.\n`
19 );
20 }
21 }
22}
23
24globalThis.fetch = new Proxy(globalThis.fetch, {
25 apply(target, thisArg, argArray) {
26 const [request, init] = argArray;
27 checkURL(request, init);
28 return Reflect.apply(target, thisArg, argArray);
29 },
30});