lib/httpx/transcoder/body.rb in httpx-0.3.1 vs lib/httpx/transcoder/body.rb in httpx-0.4.0

- old
+ new

@@ -2,10 +2,12 @@ require "forwardable" module HTTPX::Transcoder module Body + Error = Class.new(HTTPX::Error) + module_function class Encoder extend Forwardable @@ -20,9 +22,11 @@ @raw.bytesize elsif @raw.respond_to?(:to_ary) @raw.map(&:bytesize).reduce(0, :+) elsif @raw.respond_to?(:size) @raw.size || Float::INFINITY + elsif @raw.respond_to?(:length) + @raw.length || Float::INFINITY elsif @raw.respond_to?(:each) Float::INFINITY else raise Error, "cannot determine size of body: #{@raw.inspect}" end