lib/grape/request.rb in grape-1.8.0 vs lib/grape/request.rb in grape-2.0.0
- old
+ new
@@ -44,10 +44,16 @@
headers[transformed_header] = v
end
end
end
- def transform_header(header)
- -header[5..].split('_').each(&:capitalize!).join('-')
+ if Grape.lowercase_headers?
+ def transform_header(header)
+ -header[5..].tr('_', '-').downcase
+ end
+ else
+ def transform_header(header)
+ -header[5..].split('_').map(&:capitalize).join('-')
+ end
end
end
end