fix: wrong base url format causing error when constructing new URL

This commit is contained in:
Andrew Tatomyr 2022-05-11 18:21:23 +02:00 committed by Alex Varchuk
parent 311d2ce64d
commit 7ceb434034
2 changed files with 2 additions and 2 deletions

View File

@ -58,7 +58,7 @@ export class OpenAPIParser {
this.spec = spec; this.spec = spec;
this.allowMergeRefs = spec.openapi.startsWith('3.1'); 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') { if (typeof specUrl === 'string') {
this.specUrl = new URL(specUrl, href).href; this.specUrl = new URL(specUrl, href).href;
} }

View File

@ -21,7 +21,7 @@ export class ExampleModel {
this.summary = example.summary; this.summary = example.summary;
this.description = example.description; this.description = example.description;
if (example.externalValue) { if (example.externalValue) {
this.externalValueUrl = new URL(example.externalValue, parser.specUrl || '').href; this.externalValueUrl = new URL(example.externalValue, parser.specUrl).href;
} }
parser.exitRef(infoOrRef); parser.exitRef(infoOrRef);