lib/httpx/request.rb in httpx-0.6.3 vs lib/httpx/request.rb in httpx-0.6.4

- old
+ new

@@ -58,19 +58,21 @@ @body = @options.request_body_class.new(@headers, @options) @state = :idle end + # :nocov: if RUBY_VERSION < "2.2" # rubocop: disable Lint/UriEscapeUnescape: def initialize_with_escape(verb, uri, options = {}) initialize_without_escape(verb, URI.escape(uri.to_s), options) end alias_method :initialize_without_escape, :initialize alias_method :initialize, :initialize_with_escape # rubocop: enable Lint/UriEscapeUnescape: end + # :nocov: def merge_headers(h) @headers = @headers.merge(h) end @@ -121,13 +123,19 @@ chunk.dup rescue StopIteration nil end + # :nocov: def inspect - "#<Request #{@verb.to_s.upcase} #{path} @headers=#{@headers.to_hash} @body=#{@body}>" + "#<HTTPX::Request:#{object_id} " \ + "#{@verb.to_s.upcase} " \ + "#{uri} " \ + "@headers=#{@headers} " \ + "@body=#{@body}>" end + # :nocov: class Body class << self def new(*, options) return options.body if options.body.is_a?(self) @@ -199,9 +207,16 @@ end def chunk! @headers.add("transfer-encoding", "chunked") end + + # :nocov: + def inspect + "#<HTTPX::Request::Body:#{object_id} " \ + "#{unbounded_body? ? "stream" : "@bytesize=#{bytesize}"}>" + end + # :nocov: end def transition(nextstate) case nextstate when :idle