class Body
pub class Body :: [Reader]
Conforms to Reader.
A message's body as a Reader: the bytes up to the message's end, however it is framed. Once
read to the end, the connection goes back to the client for the next request, or is closed.
Its read throws IoError with kind UnexpectedEof where the connection ends inside the
body, and InvalidData for a chunk that is framed wrongly.
Methods
pub static fn of(bytes: Slice<uint8>): Body
Returns a body of the bytes.
pub static fn from(source: Reader, length: ?int): Body
Returns a body read from source, with its length where known.
pub fn length(): ?int
Returns the body's length where it is known before it is read, null otherwise.
pub mut fn read(into: Slice<uint8>): int throws [IoError, Cancelled]
pub fn isDone(): bool
Returns whether the body has been read to its end.
pub mut fn readAll(): uint8[] throws [IoError, Cancelled]
Reads the rest of the body, whole.
Errors
Throws IoError where the connection fails or the body is framed wrongly, and Cancelled
where the task is cancelled while reading.