# `FindSiteIcon.Util.HTTPUtils`
[🔗](https://github.com/XukuLLC/find_site_icon/blob/v1.1.0/lib/find_site_icon/utils/http_utils.ex#L1)

Small wrapper around Req with project defaults.

Accepts the same options as `Req.new/1`, plus the following defaults that
callers may override by passing the key explicitly:

* `:timeout` -> applied to both connect and receive timeouts. Defaults to 30s.
* `:compressed` -> decompresses encoded response bodies. Defaults to `true`.
* `:pool_max_idle_time` -> milliseconds before idle Finch socket pools are
  terminated. Defaults to 30s so file descriptors are reclaimed when probing
  many distinct hosts. Pass `:infinity` to keep pools alive forever, which
  was Req's behaviour prior to find_site_icon 1.0.2. See issue #15.

`:connect_options`, `:inet6` and `:pool_max_idle_time` are folded into a
single `:finch` keyword list before the options reach Req. Req 0.7 deprecated
top-level `:pool_max_idle_time` in favour of `finch: [pool_max_idle_time:
...]`, and it raises when `:finch` and `:connect_options` are set on the same
request, so the two have to travel together. `Req.Finch.pool_options/1` does
the translation, which keeps the full `:connect_options` surface working
without restating Req's mapping here.

The defaults above are applied by `new/1` only. `do_get/3` and `do_head/3`
merge the options they are handed into the ones the request already
carries, so a prebuilt `t:Req.Request.t/0` keeps its pool settings and a
per-call `:timeout` changes only the timeouts. Nested `:connect_options`
(such as `:transport_opts`) are merged key by key.

Callers may also pass `:finch` options directly, which are merged over the
computed pool options. With `finch: [name: MyFinch]` the named pool owns its
configuration, so no pool options are added, on `new/1` or on later calls;
Req rejects pool options next to a pool name.

# `do_get`

```elixir
@spec do_get(binary() | Req.Request.t(), keyword(), keyword()) ::
  {:error, Exception.t()} | {:ok, Req.Response.t()}
```

# `do_head`

```elixir
@spec do_head(binary() | Req.Request.t(), keyword(), keyword()) ::
  {:error, Exception.t()} | {:ok, Req.Response.t()}
```

# `new`

```elixir
@spec new(keyword()) :: Req.Request.t()
```

---

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