MCPcopy
hub / github.com/swagger-api/swagger-ui / buildUrl

Function buildUrl

src/core/utils/url.js:18–27  ·  view source on GitHub ↗
(url, specUrl, { selectedServer="" } = {})

Source from the content-addressed store, hash-verified

16}
17
18export function buildUrl(url, specUrl, { selectedServer="" } = {}) {
19 if (!url) return undefined
20 if (isAbsoluteUrl(url)) return url
21
22 const baseUrl = buildBaseUrl(selectedServer, specUrl)
23 if (!isAbsoluteUrl(baseUrl)) {
24 return new URL(url, window.location.href).href
25 }
26 return new URL(url, baseUrl).href
27}
28
29/**
30 * Safe version of buildUrl function. `selectedServer` can contain server variables

Callers 3

utils.jsFile · 0.90
buildUrlThunkFunction · 0.90
safeBuildUrlFunction · 0.85

Calls 2

isAbsoluteUrlFunction · 0.85
buildBaseUrlFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…