lib/async/http/request.rb in async-http-0.35.1 vs lib/async/http/request.rb in async-http-0.36.0
- old
+ new
@@ -25,19 +25,21 @@
module Async
module HTTP
class Request
prepend Body::Reader
- def initialize(authority = nil, method = nil, path = nil, version = nil, headers = [], body = nil)
+ def initialize(scheme = nil, authority = nil, method = nil, path = nil, version = nil, headers = [], body = nil)
+ @scheme = scheme
@authority = authority
@method = method
@path = path
@version = version
@headers = headers
@body = body
end
+ attr_accessor :scheme
attr_accessor :authority
attr_accessor :method
attr_accessor :path
attr_accessor :version
attr_accessor :headers
@@ -52,18 +54,22 @@
end
def self.[](method, path, headers, body)
body = Body::Buffered.wrap(body)
- self.new(nil, method, path, nil, headers, body)
+ self.new(nil, nil, method, path, nil, headers, body)
end
def idempotent?
method != POST && (body.nil? || body.empty?)
end
def to_s
"#{@method} #{@path} #{@version}"
+ end
+
+ def inspect
+ "\#<#{self.class} #{self.to_s} scheme=#{@scheme.inspect} authority=#{@authority.inspect} headers=#{@headers.to_h.inspect} body=#{@body.inspect}>"
end
end
end
end