Skip to content

Plain HTTP

Wayfarer can retrieve pages via plain HTTP requests with the :http adapter, also alongside automated browsers.

Ad-hoc GET requests

When automating browsers, it can be useful to additionally retrieve another page or even the current page over plain HTTP. Jobs can fetch URLs to pages with #http:

class DummyJob < Wayfarer::Base
  route.to :index

  def index
    http.fetch("https://example.com") # => #<Wayfarer::Page ...>
  end
end

By default, 3 redirects are followed, and this number can be configured by passing the follow keyword:

http.fetch(url, follow: 5)

When redirected too often, Wayfarer::Networking::RedirectsExhaustedError is raised.