MCPcopy Create free account
hub / github.com/simstudioai/sim / resolveHost

Function resolveHost

apps/sim/app/api/tools/sap_s4hana/proxy/route.ts:163–173  ·  view source on GitHub ↗
(req: ProxyRequest)

Source from the content-addressed store, hash-verified

161}
162
163function 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
175function buildOdataUrl(req: ProxyRequest, pathOverride?: string): string {
176 const host = resolveHost(req)

Callers 1

buildOdataUrlFunction · 0.70

Calls 3

assertSafeSapExternalUrlFunction · 0.90
replaceMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected