From 195446337159d2cb92b48510af7311fe0cc0f5bb Mon Sep 17 00:00:00 2001 From: Emilien Devos <4016501+unixfox@users.noreply.github.com> Date: Sun, 20 Oct 2024 23:53:08 +0200 Subject: [PATCH] fix Shadowing outer local variable `response` --- src/invidious/yt_backend/youtube_api.cr | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/invidious/yt_backend/youtube_api.cr b/src/invidious/yt_backend/youtube_api.cr index de205034..b0494203 100644 --- a/src/invidious/yt_backend/youtube_api.cr +++ b/src/invidious/yt_backend/youtube_api.cr @@ -648,11 +648,11 @@ module YoutubeAPI puts "invidious companion section" puts invidious_companion_urls[Random.rand(invidious_companion_urls.size)] begin - response = make_client(URI.parse(invidious_companion_urls[Random.rand(invidious_companion_urls.size)]), + invidious_companion_response = make_client(URI.parse(invidious_companion_urls[Random.rand(invidious_companion_urls.size)]), &.post(endpoint, headers: headers, body: data.to_json)) - body = response.body - if (response.status_code != 200) - raise Exception.new("status code: " + response.status_code.to_s + " and body: " + body) + body = invidious_companion_response.body + if (invidious_companion_response.status_code != 200) + raise Exception.new("status code: " + invidious_companion_response.status_code.to_s + " and body: " + body) end rescue ex raise InfoException.new("Error while communicating with Invidious companion: " + (ex.message || "no extra info found"))