(origin: string | undefined)
| 55 | const hasHttpScheme = (value: string): boolean => /^https?:\/\//.test(value.trim()); |
| 56 | |
| 57 | const canParseOrigin = (origin: string | undefined): boolean => { |
| 58 | if (origin === undefined) return true; |
| 59 | const trimmed = origin.trim(); |
| 60 | if (!trimmed) return true; |
| 61 | return URL.canParse(hasHttpScheme(trimmed) ? trimmed : `http://${trimmed}`); |
| 62 | }; |
| 63 | |
| 64 | const canParseApiBaseUrl = (apiBaseUrl: string | undefined): boolean => { |
| 65 | if (apiBaseUrl === undefined) return true; |
no test coverage detected