diff --git a/src/services/OpenAPIParser.ts b/src/services/OpenAPIParser.ts index b9883ff9d7..6653699752 100644 --- a/src/services/OpenAPIParser.ts +++ b/src/services/OpenAPIParser.ts @@ -58,7 +58,7 @@ export class OpenAPIParser { this.spec = spec; this.allowMergeRefs = spec.openapi.startsWith('3.1'); - const href = IS_BROWSER ? window.location.href : ''; + const href = IS_BROWSER ? window.location.href : undefined; if (typeof specUrl === 'string') { this.specUrl = new URL(specUrl, href).href; } diff --git a/src/services/models/Example.ts b/src/services/models/Example.ts index 016e5caa18..1eb81847f6 100644 --- a/src/services/models/Example.ts +++ b/src/services/models/Example.ts @@ -21,7 +21,7 @@ export class ExampleModel { this.summary = example.summary; this.description = example.description; if (example.externalValue) { - this.externalValueUrl = new URL(example.externalValue, parser.specUrl || '').href; + this.externalValueUrl = new URL(example.externalValue, parser.specUrl).href; } parser.exitRef(infoOrRef);