INNER CODE UNIT · JavaScript
atlasRequest
WJZ-P/gemini-skill · src/atlas-provider.js:24
async function atlasRequest(path, { apiKey, method = 'GET', body, timeoutMs } = {}) {
const finalApiKey = resolveApiKey(apiKey);
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), timeoutMs ?? config.atlasRequestTimeoutMs);
try {
const response = await fetch(joinUrl(config.atlasBaseUrl, path), {
method,
headers: {
Authorization: `Bearer ${finalApiKey}`,
'Content-Type': 'application/json',
},
body: body ? JSON.stringify(body) : undefined,
signal: controller.signal,
});
const { raw, data } = await parseJsonSafely(response);
if (!response.ok) {