# `Macaw.Live.Proxy.Fetcher`
[🔗](https://github.com/dcoai/macaw_live/blob/v0.1.0/lib/macaw/live/proxy/fetcher.ex#L1)

How the proxy fetches upstream (spec/06 §1.6), a behavior over an argument, so a test
passes a fetcher of its own and the proxy's suite reaches no network. Copied from
visualize's `Visualize.TileProxy.Fetcher`, now given the request's headers and bounds.

`fetch(arg, url, headers, opts)` is one `GET` of `url` with exactly `headers`, `opts`
carrying `max_bytes:` and `timeout:`. It follows no redirect: an upstream `3xx` is
answered as it came. It stops reading at `max_bytes:`, so an oversized body is never
held whole: `{:error, :too_large}`. `Macaw.Live.Proxy.Fetcher.Httpc` is the default.

# `fetch`

```elixir
@callback fetch(
  arg :: term(),
  url :: String.t(),
  headers :: [{String.t(), String.t()}],
  opts :: keyword()
) ::
  {:ok,
   %{status: pos_integer(), headers: [{String.t(), String.t()}], body: binary()}}
  | {:error, :too_large | :timeout | term()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
