class Protocol::HTTP::Body::Streamable

Invokes a callback once the body has finished reading.

def self.wrap(message, &block)

def self.wrap(message, &block)
	if body = message&.body and !body.empty?
		message.body = self.new(message.body, block)
	else
		yield
	end
end

def close(error = nil)

def close(error = nil)
	if @body
		super
		
		@callback.call(error)
		
		@body = nil
	end
end

def finish

def finish
	if @body
		result = super
		
		@callback.call
		
		@body = nil
		
		return result
	end
end

def initialize(body, callback)

def initialize(body, callback)
	super(body)
	
	@callback = callback
end