FollowRedirects: Unconditionally release the connection if there is an error
authorrinpatch <rinpatch@sdf.org>
Tue, 30 Jun 2020 12:58:53 +0000 (15:58 +0300)
committerrinpatch <rinpatch@sdf.org>
Wed, 15 Jul 2020 12:26:35 +0000 (15:26 +0300)
There is no need for streaming the body if there is no body

lib/pleroma/tesla/middleware/follow_redirects.ex

index f2c502c6971d8e7beb6d3a5e433337f2771c5b39..5a70322158156d97929f0480384a05342162e1f0 100644 (file)
@@ -55,6 +55,10 @@ defmodule Pleroma.HTTP.Middleware.FollowRedirects 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)