mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
rubocop indications
This commit is contained in:
parent
2813ff9efb
commit
e36c6347bf
@ -221,7 +221,7 @@ module HTTPX
|
||||
|
||||
def emit_error(e)
|
||||
response = ErrorResponse.new(e, 0, @options)
|
||||
@pending.each do |request, _|
|
||||
@pending.each do |request, _| # rubocop:disable Performance/HashEachMethods
|
||||
emit(:response, request, response)
|
||||
end
|
||||
end
|
||||
|
@ -6,7 +6,6 @@ module HTTPX
|
||||
TimeoutError = Class.new(Error)
|
||||
|
||||
HTTPError = Class.new(Error) do
|
||||
|
||||
attr_reader :status
|
||||
|
||||
def initialize(status)
|
||||
|
@ -222,7 +222,7 @@ module HTTPX
|
||||
@error = error
|
||||
@retries = retries
|
||||
@options = Options.new(options)
|
||||
log { "#{error.class}: #{error}"}
|
||||
log { "#{error.class}: #{error}" }
|
||||
log { caller.join("\n") }
|
||||
end
|
||||
|
||||
|
@ -25,7 +25,7 @@ class HTTPTest < Minitest::Test
|
||||
|
||||
private
|
||||
|
||||
def origin(orig=httpbin)
|
||||
def origin(orig = httpbin)
|
||||
"http://#{orig}"
|
||||
end
|
||||
end
|
||||
|
@ -23,7 +23,7 @@ class HTTPSTest < Minitest::Test
|
||||
|
||||
private
|
||||
|
||||
def origin(orig=httpbin)
|
||||
def origin(orig = httpbin)
|
||||
"https://#{orig}"
|
||||
end
|
||||
end
|
||||
|
@ -32,7 +32,7 @@ class ResponseTest < Minitest::Test
|
||||
r4 = Response.new(request, 500, "2.0", {})
|
||||
assert_raises(HTTPX::HTTPError) { r4.raise_for_status }
|
||||
end
|
||||
|
||||
|
||||
def test_response_body_to_s
|
||||
opts = { threshold_size: 1024 }
|
||||
body1 = Response::Body.new(Response.new(request, 200, "2.0", {}), opts)
|
||||
|
@ -1,8 +1,7 @@
|
||||
module Requests
|
||||
module Errors
|
||||
|
||||
def test_connection_refused
|
||||
unavailable_host = URI(origin('localhost'))
|
||||
unavailable_host = URI(origin("localhost"))
|
||||
unavailable_host.port = next_available_port
|
||||
response = HTTPX.get(unavailable_host.to_s)
|
||||
assert response.is_a?(HTTPX::ErrorResponse), "response should contain errors"
|
||||
@ -12,10 +11,10 @@ module Requests
|
||||
private
|
||||
|
||||
def next_available_port
|
||||
server = TCPServer.new('localhost', 0)
|
||||
server = TCPServer.new("localhost", 0)
|
||||
server.addr[1]
|
||||
ensure
|
||||
server.close
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user