mirror of
https://github.com/discourse/discourse.git
synced 2025-04-26 06:14:28 +08:00
FIX: GET request didn't use headers
This commit is contained in:
parent
57ee779b1e
commit
92df6890df
@ -87,16 +87,16 @@ class FinalDestination
|
|||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def small_get(headers)
|
def small_get(request_headers)
|
||||||
status_code, headers = nil
|
status_code, response_headers = nil
|
||||||
|
|
||||||
catch(:done) do
|
catch(:done) do
|
||||||
Net::HTTP.start(@uri.host, @uri.port, use_ssl: @uri.is_a?(URI::HTTPS)) do |http|
|
Net::HTTP.start(@uri.host, @uri.port, use_ssl: @uri.is_a?(URI::HTTPS)) do |http|
|
||||||
http.open_timeout = timeout
|
http.open_timeout = timeout
|
||||||
http.read_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
|
status_code = resp.code.to_i
|
||||||
headers = resp.to_hash
|
response_headers = resp.to_hash
|
||||||
|
|
||||||
# see: https://bugs.ruby-lang.org/issues/15624
|
# see: https://bugs.ruby-lang.org/issues/15624
|
||||||
# if we allow response to return then body will be read
|
# if we allow response to return then body will be read
|
||||||
@ -106,7 +106,7 @@ class FinalDestination
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
[status_code, headers]
|
[status_code, response_headers]
|
||||||
end
|
end
|
||||||
|
|
||||||
# this is a new interface for simply getting
|
# this is a new interface for simply getting
|
||||||
|
Loading…
x
Reference in New Issue
Block a user