import { API_URL } from "https://esm.town/v/std/API_URL";
import { rawFetch } from "https://esm.town/v/std/rawFetch";
export async function fetch(input: string | URL, requestInit?: RequestInit) {
let query = new URLSearchParams({
url: input.toString(),
});
return rawFetch(`${API_URL}/v1/fetch?${query}`, {
...requestInit,
headers: {
"X-Valtown-Authorization": `Bearer ${Deno.env.get("valtown")}`,
...requestInit?.headers ?? {},
},
});
}