Skip to content

Commit

Permalink
Use lowercase response headers in Rack example
Browse files Browse the repository at this point in the history
Because HTTP/2 requires that headers are sent in lowercase, Rack has
started validating that no header contains an uppercase letter.

We were setting uppercase headers as that was a common convention in
HTTP/1.1, where they were interpreted in a case-insensitive fashion.

This change makes us compatible with Rack 3.0 without breaking
compatibiility for older versions (not that it would matter for this
example code).

Signed-off-by: Chris Sinjakli <chris@sinjakli.co.uk>
  • Loading branch information
Sinjo committed Nov 24, 2022
1 parent ea01d97 commit c78dbb0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/rack/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ srand
app = lambda do |_|
case rand
when 0..0.8
[200, { 'Content-Type' => 'text/html' }, ['OK']]
[200, { 'content-type' => 'text/html' }, ['OK']]
when 0.8..0.95
[404, { 'Content-Type' => 'text/html' }, ['Not Found']]
[404, { 'content-type' => 'text/html' }, ['Not Found']]
else
raise NoMethodError, 'It is a bug!'
end
Expand Down

0 comments on commit c78dbb0

Please sign in to comment.