lib/httpx/request.rb in httpx-0.4.1 vs lib/httpx/request.rb in httpx-0.5.0
- old
+ new
@@ -33,13 +33,13 @@
USER_AGENT = "httpx.rb/#{VERSION}"
attr_reader :verb, :uri, :headers, :body, :state
- attr_reader :options
+ attr_reader :options, :response
- attr_accessor :response
+ attr_accessor :timer
def_delegator :@body, :<<
def_delegator :@body, :empty?
@@ -64,9 +64,16 @@
@headers = @headers.merge(h)
end
def scheme
@uri.scheme
+ end
+
+ def response=(response)
+ return unless response
+
+ @timer.cancel if @timer
+ @response = response
end
def path
path = uri.path.dup
path << "/" if path.empty?