(req: ProxyRequest)
| 161 | } |
| 162 | |
| 163 | function resolveHost(req: ProxyRequest): string { |
| 164 | if (req.deploymentType === 'cloud_public') { |
| 165 | const constructed = `https://${req.subdomain}-api.s4hana.ondemand.com` |
| 166 | return assertSafeSapExternalUrl(constructed, 'subdomain').toString().replace(/\/+$/, '') |
| 167 | } |
| 168 | if (!req.baseUrl) { |
| 169 | throw new Error('baseUrl is required for cloud_private and on_premise deployments') |
| 170 | } |
| 171 | const trimmed = req.baseUrl.replace(/\/+$/, '') |
| 172 | return assertSafeSapExternalUrl(trimmed, 'baseUrl').toString().replace(/\/+$/, '') |
| 173 | } |
| 174 | |
| 175 | function buildOdataUrl(req: ProxyRequest, pathOverride?: string): string { |
| 176 | const host = resolveHost(req) |
no test coverage detected