question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Headers properties should be case insensitive.

See original GitHub issue

HTTP Header names are case insensitive. Swagger specification enforce to be case sensitive all field names without exceptions.

All field names in the specification are case sensitive.

Parameter names are case sensitive.

The specification should clarify headers names are case insensitive and must be validated in that way.

So the following schema:

"parameters": [
  {
    "name": "petId",
    "in": "heaer",
    "type": "string"
  }
]

"headers": {
  "X-Rate-Limit-Limit": {
    "description": "The number of allowed requests in the current period",
    "type": "integer"
  }
}

Should be validate these headers as valid headers:

headers: [
  "PETID",
  "x-rate-limit-limit"
]

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:3
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
IndunilRathnayakecommented, Jul 3, 2020

Hi @jharmn,

Would like to know the conclusion of this discussion. We have the same concern where the java-library in [1] has been used, which is built based on the OpenAPI specification.

As per the Hypertext Transfer Protocol specification in [2] :

4.2 Message Headers
Field names are case-insensitive.

As per the OpenAPI specification v3.0 in [3] :

All field names in the specification are case sensitive. This includes all fields that are used as keys in a map, except where explicitly noted that keys are case insensitive.
header - Custom headers that are expected as part of the request. Note that RFC7230 states header names are case insensitive. 

So that the OpenAPI specification not expecting to validate header names, case-sensitively. Rather stating to validate case-insensitively. Please verify.

[1] https://bitbucket.org/atlassian/swagger-request-validator/src/swagger-request-validator-2.3.0/ [2] https://tools.ietf.org/html/rfc2616#section-4.2 [3] https://swagger.io/specification/

Thanks Indunil

0reactions
casualjimcommented, Jan 9, 2016

I think it should be spec’ed that headers need to be canonicalized. It should at the very least trigger a validation warning by the tools, consistently.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Are HTTP headers case-sensitive? - Stack Overflow
Header names are not case sensitive. From RFC 2616 - "Hypertext Transfer Protocol -- HTTP/1.1", Section 4.2, "Message Headers": Each header field consists ......
Read more >
HTTP Headers are Case-Insensitive | Beamtic
While header names are case insensitive according to the HTTP specification, there is little reason to normalize the capitalization of ...
Read more >
Are http headers case sensitive? - My Programming Notes
Are http headers case-insensitive? The http header names are case-insensitive. So “Content-Type” is equivalent with “content-type”. Are http ...
Read more >
Violating HTTP header case-insensitive standard with "X-Sf ...
POST request with lowercase "x-sf-properties" header.
Read more >
HTTP Request Headers attributes are being Case-Sensitive ...
The default behavior of the HTTP Headers is case insensitive, the headers should be accessible within the flow using any case. Attachments.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found