Skip to content

fix(module): filter header params that duplicate security schemes#3785

Open
maruthang wants to merge 1 commit intonestjs:masterfrom
maruthang:fix/duplicate-auth-header-param-3252
Open

fix(module): filter header params that duplicate security schemes#3785
maruthang wants to merge 1 commit intonestjs:masterfrom
maruthang:fix/duplicate-auth-header-param-3252

Conversation

@maruthang
Copy link
Copy Markdown

PR Checklist

  • The commit message follows our guidelines
  • Tests for the changes have been added
  • Docs have been added / updated

PR Type

  • Bugfix

What is the current behavior?

When @Headers("Authorization") is used alongside bearer auth security, Swagger generates both a security requirement and a redundant header parameter. The header parameter's value isn't sent by Swagger UI, making it confusing.

Issue Number: #3252

What is the new behavior?

createDocument() now filters out header parameters whose names match security scheme headers (e.g., "Authorization" for http bearer/basic, custom names for apiKey in header). 6 regression tests added.

Does this PR introduce a breaking change?

  • No

When @headers("Authorization") is used alongside bearer auth,
Swagger generated both a security requirement and a redundant
header parameter. Now filters out header parameters whose names
match security scheme headers (Authorization for http schemes,
custom names for apiKey in header).

Closes nestjs#3252
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant