From 7ab5067282bd9243b30602b7b22c45b9e61e4582 Mon Sep 17 00:00:00 2001 From: Ivan Kapelyukhin Date: Wed, 26 Sep 2018 16:16:39 +0200 Subject: [PATCH] Emulate on_headers callback when the request failed --- lib/rmt/fiber_request.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/rmt/fiber_request.rb b/lib/rmt/fiber_request.rb index 5987cef28..53f5f6a96 100644 --- a/lib/rmt/fiber_request.rb +++ b/lib/rmt/fiber_request.rb @@ -17,6 +17,7 @@ def initialize(base_url, download_path:, request_fiber:, remote_file:, **options @download_path.write(chunk) end on_complete do |response| + @request_fiber.resume(response) unless (response.return_code == :ok) @request_fiber.resume(response) if @request_fiber.alive? end end