mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-13 00:02:57 -04:00
rubocoped this
This commit is contained in:
parent
994c1b853e
commit
b7e875a761
@ -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)
|
||||
|
@ -104,4 +104,4 @@ module HTTPX
|
||||
do_transition(nextstate)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -145,4 +145,4 @@ module HTTPX
|
||||
@state = nextstate
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user