sourcebot/packages/web/src/lib/server/zoektClient.ts

32 lines
568 B
TypeScript
Raw Normal View History

import { ZOEKT_WEBSERVER_URL } from "../environment"
interface ZoektRequest {
path: string,
body: string,
method: string,
2024-09-11 19:15:12 +00:00
cache?: RequestCache,
}
export const zoektFetch = async ({
path,
body,
method,
2024-09-11 19:15:12 +00:00
cache,
}: ZoektRequest) => {
const response = await fetch(
new URL(path, ZOEKT_WEBSERVER_URL),
{
method,
headers: {
"Content-Type": "application/json",
},
body,
2024-09-11 19:15:12 +00:00
cache,
}
);
// @todo : add metrics
return response;
}