Sha256: 5e1b33a7de9e6e34b7d1acfbdfd69a713e9df4a30ac4b58c2bf52634c4cefb53

Contents?: true

Size: 678 Bytes

Versions: 3

Compression:

Stored size: 678 Bytes

Contents

# Plain HTTP

Wayfarer can retrieve pages via plain HTTP requests, also alongside automated
browsers.

## Agent

The HTTP agent is the default.

## Ad-hoc requests

When automating browsers, it can be useful to additionally retrieve the page
over plain HTTP. Jobs can fetch URLs to [pages](/pages) with `#http`:

```ruby
class DummyJob < Wayfarer::Base
  route { to :index }

  def index
    http.fetch(task.url) # => #<Wayfarer::Page ...>
  end
end
```

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

```ruby
http.fetch(url, follow: 5)
```

If redirected too often, `Wayfarer::Networking::RedirectsExhaustedError` is
raised.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wayfarer-0.4.6 docs/guides/networking/http.md
wayfarer-0.4.5 docs/guides/networking/http.md
wayfarer-0.4.4 docs/guides/networking/http.md