INNER CODE UNIT · TypeScript
apiCall
buildship-ai/buildship · utilities/api-call/main.ts:2
export default async function apiCall({ url, method, contentType, authorization, body }) {
const headers = { 'Content-Type': contentType };
if (authorization) headers['Authorization'] = authorization;
const response = await fetch(url, { method, headers, body: JSON.stringify(body) });
return { status: response.status, data: await response.json() };
}