From fdf7e70acee912f091b38d80f772542ac70c4ec8 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sat, 16 Mar 2024 00:45:38 +0100 Subject: [PATCH] fix(openapi): avoid double slash for base --- src/runtime/routes/openapi.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/routes/openapi.ts b/src/runtime/routes/openapi.ts index 1cc71aed6a..307d6557d3 100644 --- a/src/runtime/routes/openapi.ts +++ b/src/runtime/routes/openapi.ts @@ -6,6 +6,7 @@ import type { ParameterObject, PathsObject, } from "openapi-typescript"; +import { joinURL } from "ufo"; import { handlersMeta } from "#internal/nitro/virtual/server-handlers"; import { useRuntimeConfig } from "#internal/nitro"; @@ -13,7 +14,7 @@ import { useRuntimeConfig } from "#internal/nitro"; export default eventHandler((event) => { const base = useRuntimeConfig()?.app?.baseURL; - const url = getRequestURL(event).origin + base; + const url = joinURL(getRequestURL(event).origin, base); return { openapi: "3.0.0",