OpenAPI: Fix custom name in apiKey type authorization being ignored

This commit is contained in:
Fuma Nama
2024-11-13 16:58:56 +08:00
parent e1a70a6729
commit 47fc20e05f
3 changed files with 8 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-openapi': patch
---
Fix custom name in `apiKey` type authorization being ignored
+1 -1
View File
@@ -145,7 +145,7 @@ function getAuthorizationField(
return {
type: 'string',
name: 'Authorization',
name: scheme.type === 'apiKey' ? scheme.name : 'Authorization',
authType: scheme.type,
defaultValue:
scheme.type === 'oauth2' ||
+2 -2
View File
@@ -90,8 +90,8 @@ export function APIPlayground({
if (bodyType !== 'form-data')
headers.append('Content-Type', 'application/json');
if (input.authorization) {
headers.append('Authorization', input.authorization);
if (input.authorization && authorization) {
headers.append(authorization.name, input.authorization);
}
Object.keys(input.header).forEach((key) => {