diff --git a/packages/core/src/lib/prepareServer.ts b/packages/core/src/lib/prepareServer.ts index ded62107..5232aabd 100644 --- a/packages/core/src/lib/prepareServer.ts +++ b/packages/core/src/lib/prepareServer.ts @@ -14,7 +14,7 @@ function stripTrailingSlash(url: string) { * */ export default function prepareServer(spec: Oas, url: string, variables: Record = {}) { - let serverIdx; + let serverIdx: number | undefined; const sanitizedUrl = stripTrailingSlash(url); (spec.api.servers || []).forEach((server, i) => { if (server.url === sanitizedUrl) { @@ -25,7 +25,7 @@ export default function prepareServer(spec: Oas, url: string, variables: Record< // If we were able to find the passed in server in the OAS servers, we should use that! If we // couldn't and server variables were passed in we should try our best to handle that, otherwise // we should ignore the passed in server and use whever the default from the OAS is. - if (serverIdx) { + if (serverIdx !== undefined) { return { selected: serverIdx, variables,