Method: HTTPX::Transcoder::BodyReader#read
- Defined in:
- lib/httpx/transcoder/utils/body_reader.rb
#read(length = nil, outbuf = nil) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/httpx/transcoder/utils/body_reader.rb', line 25 def read(length = nil, outbuf = nil) return @body.read(length, outbuf) if @body.respond_to?(:read) begin chunk = @body.next if outbuf outbuf.replace(chunk) else outbuf = chunk end outbuf unless length && outbuf.empty? rescue StopIteration end end |