Method: HTTPX::Response::Body#write
- Defined in:
- lib/httpx/response/body.rb
#write(chunk) ⇒ Object
write the response payload chunk into the buffer. Inflates the chunk when required and supported.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/httpx/response/body.rb', line 55 def write(chunk) return if @state == :closed return 0 if chunk.empty? chunk = decode_chunk(chunk) transition(:open) @buffer.write(chunk) @response.emit(:chunk_received, chunk) chunk.bytesize end |