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

Function configureHttpClient

src/services/utils/http.ts:13–23  ·  view source on GitHub ↗
(config: {
  baseUrl?: string
  token?: string
  getToken?: (() => string) | null
  on401?: (() => void) | null
})

Source from the content-addressed store, hash-verified

11let _on401: (() => void) | undefined
12
13export function configureHttpClient(config: {
14 baseUrl?: string
15 token?: string
16 getToken?: (() => string) | null
17 on401?: (() => void) | null
18}): void {
19 if (config.baseUrl !== undefined) _baseUrl = config.baseUrl
20 if (config.token !== undefined) _token = config.token
21 if (config.getToken !== undefined) _getToken = config.getToken ?? undefined
22 if (config.on401 !== undefined) _on401 = config.on401 ?? undefined
23}
24
25function resolveToken(): string {
26 return _getToken ? _getToken() : _token

Callers 2

http.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected