Skip to main content
Glama
fetch-with-timeout.ts719 B
// 타임아웃이 적용된 fetch 유틸리티 const DEFAULT_TIMEOUT = 10000; // 10초 export async function fetchWithTimeout( url: string, options: RequestInit = {}, timeout: number = DEFAULT_TIMEOUT ): Promise<Response> { const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), timeout); try { const response = await fetch(url, { ...options, signal: controller.signal, }); return response; } catch (error) { if (error instanceof Error && error.name === "AbortError") { throw new Error(`요청 시간이 초과되었습니다. (${timeout / 1000}초)`); } throw error; } finally { clearTimeout(timeoutId); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/re171113-byte/startup-helper-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server