lib/httpx/request.rb in httpx-0.2.1 vs lib/httpx/request.rb in httpx-0.3.0
- old
+ new
@@ -3,10 +3,11 @@
require "forwardable"
module HTTPX
class Request
extend Forwardable
+ using URIExtensions
METHODS = [
# RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1
:options, :get, :head, :post, :put, :delete, :trace, :connect,
@@ -69,13 +70,17 @@
path << "/" if path.empty?
path << "?#{query}" unless query.empty?
path
end
+ # https://bugs.ruby-lang.org/issues/15278
def authority
- host = @uri.host
- port_string = @uri.port == @uri.default_port ? nil : ":#{@uri.port}"
- "#{host}#{port_string}"
+ @uri.authority
+ end
+
+ # https://bugs.ruby-lang.org/issues/15278
+ def origin
+ @uri.origin
end
def query
return @query if defined?(@query)
query = []