Skip to content

Commit

Permalink
Exclude Acccept, Content-type and Authorization header from the list …
Browse files Browse the repository at this point in the history
…of parameters

Based on the OpenAPI specs, some headers are not supposed to be listed directly as parameters https://swagger.io/docs/specification/describing-parameters/#header-parameters
  • Loading branch information
ticapix authored Jun 26, 2024
1 parent 026897f commit 6fd5209
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion blacksheep/server/openapi/v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,9 @@ def get_parameter_location_for_binder(
return ParameterLocation.QUERY
if isinstance(binder, CookieBinder):
return ParameterLocation.COOKIE
if isinstance(binder, HeaderBinder):
if (isinstance(binder, HeaderBinder)
# exclude those specific header value per documentation https://swagger.io/docs/specification/describing-parameters/#header-parameters
and binder.parameter_name.lower() not in ['content-type', 'accept', 'authorization']):
return ParameterLocation.HEADER
return None

Expand Down

0 comments on commit 6fd5209

Please sign in to comment.