From 92df6890dfce6812756ad8af8ac3085a23d9c0ca Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Fri, 8 Mar 2019 21:36:49 +0100 Subject: [PATCH] FIX: GET request didn't use headers --- lib/final_destination.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/final_destination.rb b/lib/final_destination.rb index bb33ec3259d..beda159c838 100644 --- a/lib/final_destination.rb +++ b/lib/final_destination.rb @@ -87,16 +87,16 @@ class FinalDestination result end - def small_get(headers) - status_code, headers = nil + def small_get(request_headers) + status_code, response_headers = nil catch(:done) do Net::HTTP.start(@uri.host, @uri.port, use_ssl: @uri.is_a?(URI::HTTPS)) do |http| http.open_timeout = timeout http.read_timeout = timeout - http.request_get(@uri.request_uri, headers) do |resp| + http.request_get(@uri.request_uri, request_headers) do |resp| status_code = resp.code.to_i - headers = resp.to_hash + response_headers = resp.to_hash # see: https://bugs.ruby-lang.org/issues/15624 # if we allow response to return then body will be read @@ -106,7 +106,7 @@ class FinalDestination end end - [status_code, headers] + [status_code, response_headers] end # this is a new interface for simply getting