Method: HTTP::Message::Body#dump_chunked
- Defined in:
- lib/httpclient/http.rb
#dump_chunked(header = '', dev = '') ⇒ Object
Dumps message body with chunked encoding to given dev. dev needs to respond to <<.
Message header must be given as the first argument for performance reason. (header is dumped to dev, too) If no dev (the second argument) given, this method returns a dumped String.
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
# File 'lib/httpclient/http.rb', line 466 def dump_chunked(header = '', dev = '') dev << header if @body.is_a?(Parts) @body.parts.each do |part| if Message.file?(part) reset_pos(part) dump_chunks(part, dev) else dev << dump_chunk(part) end end dev << (dump_last_chunk + CRLF) elsif @body reset_pos(@body) dump_chunks(@body, dev) dev << (dump_last_chunk + CRLF) end dev end |