# `Loopback.Interceptors.TeslaGun`
[🔗](https://github.com/stefanchrobot/loopback/blob/v0.1.0/lib/loopback/interceptors/tesla_gun.ex#L1)

An interceptor for `Tesla.Adapter.Gun`, Tesla's adapter for gun.

Implementation notes:

  * The response's body is returned as the `:body_as` option tells: as a binary with
    `:plain`, the default, or as a stream of one chunk with `:stream`. `:chunks` isn't
    supported for requests that fakes handle, and raises. `:max_body` applies like in the
    adapter.
  * Like in the adapter, an empty response body is `""`, also with `:stream`.
  * A request body from a stream, a function or a `Tesla.Multipart` reaches the fakes whole.
  * `Loopback.HTTPError` reasons are returned the way the adapter returns them: `:timeout`
    and `:closed` as `:recv_response_timeout`, and the other reasons, like `:econnrefused`,
    as `:timeout`, since gun keeps retrying to connect until the adapter stops waiting.
  * The options that control the connection, like `:conn` and `:timeout`, apply only to
    requests passed through.

---

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