app/lib/rack/baseup.rb
# Returns headers which starts with "HTTP"
#
# @params [Rack::Request] req
# @return [Array]
Returns headers which starts with "HTTP"
Returns headers which starts with " HTTP "
def request_headers(req)
      headers = []
      headers << "Content-Type: #{req.content_type}" if req.content_type
      headers << "Content-Length: #{req.content_length}" if req.content_length.to_i.positive?
      req.env.each do |key, value|
        next unless key.include? "HTTP_"
        parts = key.scan(/^HTTP_([A-Z_]+)/).flatten.first
        new_key = parts.split('_').map do |part|
          part.sub(/(?<=^[A-Z])[A-Z]*/, &:downcase)
        end.join("-")
        headers << "#{new_key}: #{value}"
      end
      headers.sort
    end
def request_headers ( req ) headers = [ ] headers << "Content-Type: #{req.content_type}" if req . content_type headers << "Content-Length: #{req.content_length}" if req . content_length . to_i . positive? req . env . each do | key , value | next unless key . include? "HTTP_" parts = key . scan ( / ^HTTP_([A-Z_]+) / ) . flatten . first new_key = parts . split ( '_' ) . map do | part | part . sub ( / (?<=^[A-Z])[A-Z]* / , & :downcase ) end . join ( "-" ) headers << "#{new_key}: #{value}" end headers . sort end
Returns headers which starts with "HTTP"
Returns headers which starts with " HTTP "
None
Array
req
<not_specific>
params
None