FollowRedirects: Unconditionally release the connection if there is an error

There is no need for streaming the body if there is no body
This commit is contained in:
rinpatch 2020-06-30 15:58:53 +03:00
parent 9df5918974
commit 12fa5541f0

View File

@ -55,6 +55,10 @@ defp redirect(env, next, left) do
release_conn(opts)
{:error, {__MODULE__, :too_many_redirects}}
{:error, _} = e ->
release_conn(opts)
e
other ->
unless opts[:body_as] == :chunks do
release_conn(opts)