OpenAPI: Fix empty params

This commit is contained in:
fuma-nama
2024-08-02 21:02:29 +08:00
parent 4247170b09
commit 01465727c2
2 changed files with 8 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-openapi': patch
---
Fix empty params
+3 -2
View File
@@ -97,7 +97,7 @@ export function APIPlayground({
const url = new URL(`${baseUrl ?? window.location.origin}${pathname}`);
Object.keys(input.query).forEach((key) => {
const paramValue = input.query[key];
if (typeof paramValue === 'string')
if (typeof paramValue === 'string' && paramValue.length > 0)
url.searchParams.append(key, paramValue);
});
@@ -112,7 +112,8 @@ export function APIPlayground({
Object.keys(input.header).forEach((key) => {
const paramValue = input.header[key];
if (typeof paramValue === 'string') headers.append(key, paramValue);
if (typeof paramValue === 'string' && paramValue.length > 0)
headers.append(key, paramValue);
});
const bodyValue =