MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / get

Function get

src/services/utils/http.ts:77–88  ·  view source on GitHub ↗
(path: string, signal?: AbortSignal)

Source from the content-addressed store, hash-verified

75}
76
77export async function get<T>(path: string, signal?: AbortSignal): Promise<T> {
78 const resp = await fetch(`${_baseUrl}${path}`, {
79 headers: getAuthHeaders(),
80 signal,
81 })
82 handle401(resp)
83 if (!resp.ok) {
84 const text = await resp.text().catch(() => '')
85 throw new Error(`HTTP ${resp.status}: ${text}`)
86 }
87 return resp.json() as Promise<T>
88}
89
90export async function post<T>(path: string, body?: unknown, signal?: AbortSignal): Promise<T> {
91 const hasBody = body !== undefined

Callers 15

getInfoMethod · 0.90
getDataDirMethod · 0.90
getLatestImportLogMethod · 0.90
hasConfigMethod · 0.90
getConfigStoreMethod · 0.90
getFastModelSlotMethod · 0.90
getProvidersMethod · 0.90
getProviderRegistryMethod · 0.90
getModelCatalogMethod · 0.90
getPreferencesMethod · 0.90
getUiConfigMethod · 0.90

Calls 3

getAuthHeadersFunction · 0.85
handle401Function · 0.85
textMethod · 0.80

Tested by

no test coverage detected