Skip to content

Commit

Permalink
Exclude Authorization header from openapi specs. (#714)
Browse files Browse the repository at this point in the history
In addition to the existing 2 headers, the Authorization header is also
not allowed. Instead it is taken care of by the security schemes
  • Loading branch information
janolivermr authored Aug 21, 2023
1 parent 6a9d51b commit ce566d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Writing/OpenAPISpecWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ protected function generateEndpointParametersSpec(OutputEndpointData $endpoint):

if (count($endpoint->headers)) {
foreach ($endpoint->headers as $name => $value) {
if (in_array($name, ['Content-Type', 'content-type', 'Accept', 'accept']))
if (in_array(strtolower($name), ['content-type', 'accept', 'authorization']))
// These headers are not allowed in the spec.
// https://swagger.io/docs/specification/describing-parameters/#header-parameters
continue;
Expand Down

0 comments on commit ce566d4

Please sign in to comment.