* 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)
| 42 | * are rewritten to the Internal Server origin. Otherwise returns as-is. |
| 43 | */ |
| 44 | function 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, |