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

Function resolveFullUrl

src/services/utils/http.ts:44–53  ·  view source on GitHub ↗

* Resolve a URL path against the configured base. * When baseUrl is absolute (http://...), relative paths like "/_web/..." * are rewritten to the Internal Server origin. Otherwise returns as-is.

(url: string)

Source from the content-addressed store, hash-verified

42 * are rewritten to the Internal Server origin. Otherwise returns as-is.
43 */
44function resolveFullUrl(url: string): string {
45 if (!_baseUrl.startsWith('http://') && !_baseUrl.startsWith('https://')) return url
46 if (url.startsWith('http://') || url.startsWith('https://')) return url
47 try {
48 const origin = new URL(_baseUrl).origin
49 return `${origin}${url}`
50 } catch {
51 return url
52 }
53}
54
55/**
56 * Authenticated fetch wrapper — same API as native fetch,

Callers 1

fetchWithAuthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected