module Async::HTTP::Body::Reader

def body?

Whether there is a body?
def body?
	@body and !@body.empty?
end

def close

Close the connection as quickly as possible. Discards body.
def close
	self.stop
end

def each(&block)

Read chunks from the body.
def each(&block)
	self.body.each(&block)
end

def finish

Gracefully finish reading the body. This will buffer the remainder of the body.
def finish
	if self.body
		self.body = self.body.close
	end
end

def read

Reads the entire request/response body.
def read
	if self.body
		self.body.join
	end
end

def stop(error = EOFError)

Immediately stop reading the body. May close the underlying connection. Discards body.
def stop(error = EOFError)
	if self.body
		self.body.stop(error)
		self.body = nil
	end
end