diff --git a/lib/tesla.ex b/lib/tesla.ex index d1ab2064..3c6c20ad 100644 --- a/lib/tesla.ex +++ b/lib/tesla.ex @@ -64,7 +64,6 @@ defmodule Tesla do alias Tesla.Env - require Tesla.Adapter.Httpc @default_adapter Tesla.Adapter.Httpc defmacro __using__(opts \\ []) do diff --git a/lib/tesla/adapter/gun.ex b/lib/tesla/adapter/gun.ex index 08186095..b4a080a3 100644 --- a/lib/tesla/adapter/gun.ex +++ b/lib/tesla/adapter/gun.ex @@ -527,6 +527,25 @@ if Code.ensure_loaded?(:gun) do end end end + + defp next_reply_state(_state, {:gun_response, _pid, _stream, :nofin, _status, _headers}), + do: :streaming + + defp next_reply_state(state, _message), do: state + + defp terminal_reply_message?({:gun_response, _pid, _stream, :fin, _status, _headers}), + do: true + + defp terminal_reply_message?({:gun_data, _pid, _stream, :fin, _data}), do: true + defp terminal_reply_message?({:gun_error, _pid, _stream, _reason}), do: true + defp terminal_reply_message?({:gun_error, _pid, _reason}), do: true + + defp terminal_reply_message?( + {:gun_down, _pid, _protocol, _reason, _killed_streams, _unprocessed} + ), + do: true + + defp terminal_reply_message?(_message), do: false end defp route_reply_message(request_owner, stream_owner, original_reply_to, message) do @@ -547,25 +566,6 @@ if Code.ensure_loaded?(:gun) do end end - defp next_reply_state(_state, {:gun_response, _pid, _stream, :nofin, _status, _headers}), - do: :streaming - - defp next_reply_state(state, _message), do: state - - defp terminal_reply_message?({:gun_response, _pid, _stream, :fin, _status, _headers}), - do: true - - defp terminal_reply_message?({:gun_data, _pid, _stream, :fin, _data}), do: true - defp terminal_reply_message?({:gun_error, _pid, _stream, _reason}), do: true - defp terminal_reply_message?({:gun_error, _pid, _reason}), do: true - - defp terminal_reply_message?( - {:gun_down, _pid, _protocol, _reason, _killed_streams, _unprocessed} - ), - do: true - - defp terminal_reply_message?(_message), do: false - defp notify_reply_to(reply_to, request_owner, _message) when is_pid(reply_to) and reply_to == request_owner, do: :ok diff --git a/mix.exs b/mix.exs index 4644e316..ce18c6cc 100644 --- a/mix.exs +++ b/mix.exs @@ -20,11 +20,14 @@ defmodule Tesla.Mixfile do plt_add_apps: [:mix, :inets, :idna, :ssl_verify_fun, :ex_unit], plt_add_deps: :apps_direct ], - docs: docs(), - preferred_cli_env: [coveralls: :test, "coveralls.html": :test] + docs: docs() ] end + def cli do + [preferred_envs: [coveralls: :test, "coveralls.html": :test]] + end + def application do [extra_applications: [:logger, :ssl, :inets]] end