grape
grape copied to clipboard
Allow lowercase HTTP/2 headers
HTTP/2 defines that HTTP headers be lowercase.
Grape consistently normalizes HTTP headers to PascalCase. This is ok since it's consistent.
However, there are more and more API clients which normalize HTTP headers to lowercase. One example is Axios.
This means that the exact same HTTP header name cannot be used as-is at the Grape API and Client side, since both implement a normalization of their own.
For example Rack provides Rack::Headers middleware which normalizes HTTP headers to lowercase per HTTP/2. It also seems the upcoming Rack 3 will provide lowercased HTTP headers by default.
I suggest an option to somehow enable HTTP header normalization to lowercase in Grape.
References:
- https://github.com/rack/rack/issues/1592
- https://github.com/rack/rack/pull/1800
See https://github.com/ruby-grape/grape/pull/2355 for a beginning of solving this.