rubocoped this

This commit is contained in:
HoneyryderChuck 2018-05-28 10:00:54 +01:00
parent 994c1b853e
commit b7e875a761
7 changed files with 15 additions and 14 deletions

View File

@ -44,11 +44,11 @@ module HTTPX
def by(uri, options)
type = options.transport || begin
case uri.scheme
when "http" then "tcp"
when "https" then "ssl"
else
raise Error, "#{uri}: #{uri.scheme}: unrecognized channel"
end
when "http" then "tcp"
when "https" then "ssl"
else
raise Error, "#{uri}: #{uri.scheme}: unrecognized channel"
end
end
io = IO.registry(type).new(uri, options)
new(io, options)

View File

@ -104,4 +104,4 @@ module HTTPX
do_transition(nextstate)
end
end
end
end

View File

@ -145,4 +145,4 @@ module HTTPX
@state = nextstate
end
end
end
end

View File

@ -46,10 +46,11 @@ module HTTPX
Errno::EALREADY,
::IO::WaitReadable
end
private
def build_socket
Socket.new(Socket::PF_UNIX, :STREAM, 0)
end
end
end
end

View File

@ -56,7 +56,7 @@ module HTTPX
:request_body_class => Class.new(Request::Body),
:response_body_class => Class.new(Response::Body),
:transport => nil,
:transport_options => nil
:transport_options => nil,
}
defaults.merge!(options)

View File

@ -8,10 +8,10 @@ class UnixTest < Minitest::Test
def test_unix_client
on_unix_server do |path|
client = Client.new(transport: "unix", transport_options: { path: path})
client = Client.new(transport: "unix", transport_options: { path: path })
response = client.get("http://unix.com/ping")
assert response.status == 200, "unexpected code (#{response.status})"
assert response.to_s == "pong", "unexpected body (#{response.to_s})"
assert response.to_s == "pong", "unexpected body (#{response})"
response.close
client.close
end
@ -19,7 +19,7 @@ class UnixTest < Minitest::Test
private
RESPONSE_HEADER = (<<-HTTP).lines.map.map(&:chomp).join("\r\n") << ("\r\n" * 2)
RESPONSE_HEADER = <<-HTTP.lines.map.map(&:chomp).join("\r\n") << ("\r\n" * 2)
HTTP/1.1 200 OK
Date: Mon, 27 Jul 2009 12:28:53 GMT
Content-Length: 4
@ -53,4 +53,4 @@ Connection: close
th.terminate
end
end
end
end

View File

@ -77,7 +77,7 @@ class OptionsTest < Minitest::Test
:request_body_class => bar.request_body_class,
:response_body_class => bar.response_body_class,
:transport => nil,
:transport_options => nil
:transport_options => nil,
}, "options haven't merged correctly"
end