ConnectionPool middleware: fix a crash due to unimplemented behaviour

Structs don't implement Access behaviour, so this crashed. Tests didn't
catch it and I didn't test that part of the codepath. Very sorry
This commit is contained in:
rinpatch 2020-09-05 21:17:03 +03:00
parent 8c8fb84a38
commit 5298de3be6

View file

@ -32,7 +32,7 @@ def call(%Tesla.Env{url: url, opts: opts} = env, next, _) do
{:ok, env} ->
unless opts[:adapter][:body_as] == :chunks do
ConnectionPool.release_conn(conn_pid)
{:ok, pop_in(env[:opts][:adapter][:conn])}
{:ok, pop_in(env.opts[:adapter][:conn])}
else
{:ok, env}
end