lib/restclient/request.rb
def stringify_headers headers
      headers.inject({}) do |result, (key, value)|
        if key.is_a? Symbol
          key = key.to_s.split(/_/).map(&:capitalize).join('-')
        end
        if 'CONTENT-TYPE' == key.upcase
          result[key] = maybe_convert_extension(value.to_s)
        elsif 'ACCEPT' == key.upcase
          # Accept can be composed of several comma-separated values
          if value.is_a? Array
            target_values = value
          else
            target_values = value.to_s.split ','
          end
          result[key] = target_values.map { |ext|
            maybe_convert_extension(ext.to_s.strip)
          }.join(', ')
        else
          result[key] = value.to_s
        end
        result
      end
    end
def stringify_headers headers
      headers.inject({}) do |result, (key, value)|
        if key.is_a? Symbol
          key = key.to_s.split(/_/).map(&:capitalize).join('-')
        end
        if 'CONTENT-TYPE' == key.upcase
          result[key] = maybe_convert_extension(value.to_s)
        elsif 'ACCEPT' == key.upcase
          # Accept can be composed of several comma-separated values
          if value.is_a? Array
            target_values = value
          else
            target_values = value.to_s.split ','
          end
          result[key] = target_values.map { |ext|
            maybe_convert_extension(ext.to_s.strip)
          }.join(', ')
        else
          result[key] = value.to_s
        end
        result
      end
    end
def stringify_headers headers headers . inject ( { } ) do | result , ( key , value ) | if key . is_a? Symbol key = key . to_s . split ( / / ) . map ( :capitalize ) . join ( '-' ) end if 'CONTENT-TYPE' == key . upcase result [ key ] = maybe_convert_extension ( value . to_s ) elsif 'ACCEPT' == key . upcase # Accept can be composed of several comma-separated values if value . is_a? Array target_values = value else target_values = value . to_s . split ',' end result [ key ] = target_values . map { | ext | maybe_convert_extension ( ext . to_s . strip ) } . join ( ', ' ) else result [ key ] = value . to_s end result end end
Return a hash of headers whose keys are capitalized strings

 BUG: stringify_headers does not fix the capitalization of headers that
 are already Strings. Leaving this behavior as is for now for
 backwards compatibility.
 https://github.com/rest-client/rest-client/issues/599
Return a hash of headers whose keys are capitalized strings