Template
1
0

feat: initial commit

This commit is contained in:
2025-04-18 20:18:50 +00:00
commit 7df57522d2
20 changed files with 2094 additions and 0 deletions

16
adapters/http.ts Normal file
View File

@@ -0,0 +1,16 @@
import { RequestInput } from "../libraries/relay.ts";
import { RelayAdapter } from "../mod.ts";
export const http: RelayAdapter = {
async fetch({ method, url, search, body }: RequestInput) {
const res = await fetch(`${url}${search}`, { method, body });
const data = await res.text();
if (res.status >= 400) {
throw new Error(data);
}
if (res.headers.get("content-type")?.includes("json")) {
return JSON.parse(data);
}
return data;
},
};