Skip to content

Commit d0d1871

Browse files
committed
Fix Grape::Middleware::Formatter#headers
The current `#headers` implementation is wrong, rack sets headers as `http_*` so the check in `#mime_array` will always fail, because it should look for `'http_accept'` instead. Dunno if older versions of rack set http headers without the `http_` prefix though.
1 parent 4b11f63 commit d0d1871

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/grape/middleware/formatter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def default_options
1515
end
1616

1717
def headers
18-
env.dup.inject({}){|h,(k,v)| h[k.downcase] = v; h}
18+
env.dup.inject({}){|h,(k,v)| h[k.downcase[5..-1]] = v if k.downcase.start_with?('http_'); h}
1919
end
2020

2121
def before

0 commit comments

Comments
 (0)