lib/securenative/frameworks/hanami.rb in securenative-0.1.37 vs lib/securenative/frameworks/hanami.rb in securenative-0.1.38
- old
+ new
@@ -34,12 +34,19 @@
end
def self.get_headers(request)
begin
headers = {}
- request.headers.env.select { |k, _| k.in?(ActionDispatch::Http::Headers::CGI_VARIABLES) || k =~ /^HTTP_/ }.each { |header|
+
+ request.env.select { |k, _| k.in?(ActionDispatch::Http::Headers::CGI_VARIABLES) || k =~ /^HTTP_/ }.each { |header|
headers[header[0].downcase.gsub("http_", "").gsub("_", "-")] = header[1]
}
+
+ if headers.length == 0
+ request.headers.env.select { |k, _| k.in?(ActionDispatch::Http::Headers::CGI_VARIABLES) || k =~ /^HTTP_/ }.each { |header|
+ headers[header[0].downcase.gsub("http_", "").gsub("_", "-")] = header[1]
+ }
+ end
return headers
rescue StandardError
nil
end
end