From 44d78032c9fc244dcb39a5136baa063ee9d5b44c Mon Sep 17 00:00:00 2001 From: dfuqq Date: Wed, 3 Sep 2025 18:02:47 +0500 Subject: [PATCH 1/2] fix: specEndpoint correct handling this commit fixes hardcoded /api path on UI Plugins, allowing to fully provide custom route --- src/rapidocPlugin.ts | 2 +- src/redocPlugin.ts | 2 +- src/scalarPlugin.ts | 2 +- src/swaggerUIPlugin.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rapidocPlugin.ts b/src/rapidocPlugin.ts index 81d6314..4888d97 100644 --- a/src/rapidocPlugin.ts +++ b/src/rapidocPlugin.ts @@ -38,7 +38,7 @@ const rapidoc = - + `, { headers: { 'content-type': 'text/html' } }, diff --git a/src/redocPlugin.ts b/src/redocPlugin.ts index 2d975ae..5a51681 100644 --- a/src/redocPlugin.ts +++ b/src/redocPlugin.ts @@ -43,7 +43,7 @@ const redoc = - + `, diff --git a/src/scalarPlugin.ts b/src/scalarPlugin.ts index c17c2a4..f4236b2 100644 --- a/src/scalarPlugin.ts +++ b/src/scalarPlugin.ts @@ -23,7 +23,7 @@ const scalar = method: 'get', path: docsUrl, handler: async req => { - const fullSpecUrl = `${req.protocol}//${req.headers.get('host')}/api${specEndpoint}` + const fullSpecUrl = `${req.protocol}//${req.headers.get('host')}${specEndpoint}` const html = ` diff --git a/src/swaggerUIPlugin.ts b/src/swaggerUIPlugin.ts index c43a79a..993757b 100644 --- a/src/swaggerUIPlugin.ts +++ b/src/swaggerUIPlugin.ts @@ -42,7 +42,7 @@ const swaggerUI =