Class: Capybara::Mechanize::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/monkey-patches/capybara-mechanize-patches.rb

Instance Method Summary collapse

Instance Method Details

#process_remote_request(method, url, attributes, headers) ⇒ Object

patch to remove catching all Mechanize exceptions (which are nice and specific) and throwing a useless RuntimeError



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/monkey-patches/capybara-mechanize-patches.rb', line 5

def process_remote_request(method, url, attributes, headers)
  if remote?(url)
    uri = URI.parse(url)
    uri = resolve_relative_url(url) if uri.host.nil?
    @last_remote_uri = uri
    url = uri.to_s

    reset_cache!
    args = []
    args << attributes unless attributes.empty?
    args << headers unless headers.empty?
    @agent.send(method, url, *args)
    @last_request_remote = true
  end
end