lib/httpx/response.rb in httpx-0.7.0 vs lib/httpx/response.rb in httpx-0.8.0

- old
+ new

@@ -56,11 +56,11 @@ def inspect "#<Response:#{object_id} "\ "HTTP/#{version} " \ "@status=#{@status} " \ "@headers=#{@headers} " \ - "@body=#{@body}>" + "@body=#{@body.bytesize}>" end # :nocov: def raise_for_status return if @status < 400 @@ -148,10 +148,12 @@ end def copy_to(dest) return unless @buffer + rewind + if dest.respond_to?(:path) && @buffer.respond_to?(:path) FileUtils.mv(@buffer.path, dest.path) else @buffer.rewind ::IO.copy_stream(@buffer, dest) @@ -263,9 +265,21 @@ log_exception(@error) end def status @error.message + end + + def reason + @error.class.name + end + + def headers + {} + end + + def body + @error.backtrace.join("\n") end def raise_for_status raise @error end