class Protocol::HTTP::Body::Wrapper

Wrapping body instance. Typically you’d override ‘#read`.

def self.wrap(message)

@returns [Wrapper | nil] the wrapped body or nil if the body was nil.
@parameter message [Request | Response] the message to wrap.

Wrap the body of the given message in a new instance of this class.
def self.wrap(message)
	if body = message.body
		message.body = self.new(body)
	end
end

def as_json(...)

def as_json(...)
	{
		class: self.class.name,
		body: @body&.as_json
	}
end

def buffered

def buffered
	@body.buffered
end

def close(error = nil)

def close(error = nil)
	@body.close(error)
	
	# It's a no-op:
	# super
end

def discard

def discard
	@body.discard
end

def empty?

def empty?
	@body.empty?
end

def initialize(body)

def initialize(body)
	@body = body
end

def inspect

def inspect
	@body.inspect
end

def length

def length
	@body.length
end

def read

Read the next available chunk.
def read
	@body.read
end

def ready?

def ready?
	@body.ready?
end

def rewind

def rewind
	@body.rewind
end

def rewindable?

def rewindable?
	@body.rewindable?
end

def to_json(...)

def to_json(...)
	as_json.to_json(...)
end