diff --git a/src/invidious/connection/pool.cr b/src/invidious/connection/pool.cr index a0ddfa70..611b4458 100644 --- a/src/invidious/connection/pool.cr +++ b/src/invidious/connection/pool.cr @@ -25,7 +25,7 @@ module Invidious::ConnectionPool end {% for method in %w[get post put patch delete head options] %} - def {{method.id}}(*args, **kwargs) + def {{method.id}}(*args, **kwargs, &) self.client do | client | client.{{method.id}}(*args, **kwargs) do | response | @@ -39,12 +39,10 @@ module Invidious::ConnectionPool end def {{method.id}}(*args, **kwargs) - self.client do | client | - return response = client.{{method.id}}(*args, **kwargs) + {{method.id}}(*args, **kwargs) do | response | + return response ensure - if response - response.body_io?.try &. skip_to_end - end + response.body_io?.try &. skip_to_end end end {% end %}