lib/httpx/request.rb in httpx-0.0.5 vs lib/httpx/request.rb in httpx-0.1.0
- old
+ new
@@ -41,11 +41,11 @@
def_delegator :@body, :chunk!
def initialize(verb, uri, options = {})
@verb = verb.to_s.downcase.to_sym
- @uri = URI(uri)
+ @uri = URI(URI.escape(uri.to_s))
@options = Options.new(options)
raise(Error, "unknown method: #{verb}") unless METHODS.include?(@verb)
@headers = @options.headers_class.new(@options.headers)
@@ -63,10 +63,10 @@
def scheme
@uri.scheme
end
def path
- path = uri.path
+ path = uri.path.dup
path << "/" if path.empty?
path << "?#{query}" unless query.empty?
path
end