Skip to content

Commit d5c1dfd

Browse files
authored
Merge pull request #185 from bhaleraosaurabh/Scalar-path-config-issue
Fix path issue in Scalar config
2 parents 4f51a40 + a4229eb commit d5c1dfd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const swagger = async <Path extends string = '/swagger'>(
6666

6767
const app = new Elysia({ name: '@elysiajs/swagger' })
6868

69-
app.get(path, function documentation() {
69+
app.get(path, function documentation({request}) {
7070
const combinedSwaggerOptions = {
7171
url: openAPISpecUrl,
7272
dom_id: '#swagger-ui',
@@ -85,7 +85,7 @@ export const swagger = async <Path extends string = '/swagger'>(
8585
const scalarConfiguration: ReferenceConfiguration = {
8686
spec: {
8787
...scalarConfig.spec,
88-
url: openAPISpecUrl
88+
url: `${new URL(request.url).pathname.replace(/\/$/, "")}/json`
8989
},
9090
...scalarConfig,
9191
// so we can showcase the elysia theme

0 commit comments

Comments
 (0)