(deploymentUrl: string, path: string)
| 14 | * with DNS resolution and pins the resolved IP for the actual request. |
| 15 | */ |
| 16 | export function convexApiUrl(deploymentUrl: string, path: string): string { |
| 17 | const trimmed = deploymentUrl.trim().replace(/\/+$/, '') |
| 18 | const validation = validateExternalUrl(trimmed, 'Deployment URL') |
| 19 | if (!validation.isValid) { |
| 20 | throw new Error(`${validation.error} (e.g., https://your-deployment.convex.cloud)`) |
| 21 | } |
| 22 | const parsed = new URL(trimmed) |
| 23 | if (parsed.search || parsed.hash) { |
| 24 | throw new Error( |
| 25 | 'Deployment URL must not include a query string or fragment (e.g., https://your-deployment.convex.cloud)' |
| 26 | ) |
| 27 | } |
| 28 | return `${trimmed}${path}` |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Builds the deployment admin authorization header for Convex HTTP API requests. |
no test coverage detected