Loopback.Interceptors.TeslaMint (Loopback v0.1.0)

Copy Markdown View Source

An interceptor for Tesla.Adapter.Mint, Tesla's adapter for Mint.

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 nil with :plain.
  • 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 as :timeout, :closed as "Encounter Mint error %Mint.TransportError{reason: :closed}", and the other reasons as %Mint.TransportError{}.
  • The options that control the connection, like :conn and :timeout, apply only to requests passed through.

Summary

Functions

call(env, opts)