public function toChunks($size = null)
    {
        $body = '';
        $size = $size > 0 ? $size : $this->chunkSize();
        $stream = $this->stream();
        while($chunk = $stream->read($size)) {
            $readed = strlen($chunk);
            if (!$readed) {
                break;
            }
            $body .= dechex($readed) . "\r\n" . $chunk . "\r\n";
        }
        $body .= "0\r\n\r\n";

        if ($stream->isSeekable()) {
            $stream->rewind();
        }
        return $body;
    }