class Protocol::HTTP::Body::Completable

Invokes a callback once the body has completed, either successfully or due to an error.

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 @callback
		@callback.call(error)
		@callback = nil
	end
	
	super
end

def initialize(body, callback)

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

def rewind

def rewind
	false
end

def rewindable?

def rewindable?
	false
end