def restore_env(rack_env)
      env = rack_env.fetch('faraday')
      headers = env[:request_headers]
      headers.clear

      rack_env.each do |name, value|
        next unless String === name && String === value
        if NonPrefixedHeaders.include? name or name.index('HTTP_') == 0
          name = name.sub(/^HTTP_/, '').downcase.tr('_', '-')
          headers[name] = value
        end
      end

      env[:method] = rack_env['REQUEST_METHOD'].downcase.to_sym
      env[:rack_errors] = rack_env['rack.errors']
      env
    end
def restore_env(rack_env)
      env = rack_env.fetch('faraday')
      headers = env[:request_headers]
      headers.clear

      rack_env.each do |name, value|
        next unless String === name && String === value
        if NonPrefixedHeaders.include? name or name.index('HTTP_') == 0
          name = name.sub(/^HTTP_/, '').downcase.tr('_', '-')
          headers[name] = value
        end
      end

      env[:method] = rack_env['REQUEST_METHOD'].downcase.to_sym
      env[:rack_errors] = rack_env['rack.errors']
      env
    end
rack to faraday-compatible