Method: Mechanize::HTTP::Agent#http_request

Defined in:
lib/mechanize/http/agent.rb

#http_request(uri, method, params = nil) ⇒ Object



574
575
576
577
578
579
580
581
582
583
584
585
586
# File 'lib/mechanize/http/agent.rb', line 574

def http_request uri, method, params = nil
  case uri.scheme.downcase
  when 'http', 'https' then
    klass = Net::HTTP.const_get(method.to_s.capitalize)

    request ||= klass.new(uri.request_uri)
    request.body = params.first if params

    request
  when 'file' then
    Mechanize::FileRequest.new uri
  end
end