lib/async/http/endpoint.rb in async-http-0.47.0 vs lib/async/http/endpoint.rb in async-http-0.48.0

- old
+ new

@@ -27,14 +27,14 @@ module Async module HTTP # Represents a way to connect to a remote HTTP server. class Endpoint < Async::IO::Endpoint - def self.parse(string, **options) + def self.parse(string, endpoint = nil, **options) url = URI.parse(string).normalize - return self.new(url, nil, **options) + return self.new(url, endpoint, **options) end # @option scheme [String] the scheme to use, overrides the URL scheme. # @option hostname [String] the hostname to connect to (or bind to), overrides the URL hostname (used for SNI). # @option port [Integer] the port to bind to, overrides the URL port. @@ -44,10 +44,11 @@ super(**options) raise ArgumentError, "URL must be absolute (include scheme, host): #{url}" unless url.absolute? @url = url - @endpoint = endpoint + + @endpoint = self.build_endpoint(endpoint) end def to_url url = @url.dup \ No newline at end of file