fix(#1717): add number type stringify for getPathnameFromInput (#1718)

This commit is contained in:
xqe2011
2025-04-15 19:07:39 +08:00
committed by GitHub
parent ba6aa9a8cd
commit 5a6bf8377b
2 changed files with 9 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"fumadocs-openapi": patch
---
fix(#1717): add number type stringify for getPathnameFromInput
@@ -9,6 +9,8 @@ export function getPathnameFromInput(
if (typeof paramValue === 'string' && paramValue.length > 0)
pathname = pathname.replace(`{${key}}`, paramValue);
else if (typeof paramValue === 'number')
pathname = pathname.replace(`{${key}}`, paramValue.toString());
}
const searchParams = new URLSearchParams();
@@ -17,6 +19,8 @@ export function getPathnameFromInput(
if (typeof paramValue === 'string' && paramValue.length > 0)
searchParams.append(key, paramValue);
else if (typeof paramValue === 'number')
searchParams.append(key, paramValue.toString());
}
return searchParams.size > 0 ? `${pathname}?${searchParams}` : pathname;