class ResponseBody < Protocol::HTTP::Body::Wrapper

Inherits from
Protocol::HTTP::Body::Wrapper

Wraps an upstream response body and releases its backend exchange when closed.

Definitions

def initialize(body, &release)

Initialize a response body wrapper.

Signature

parameter body Protocol::HTTP::Body::Readable

The upstream response body.

Implementation

def initialize(body, &release)
	super(body)
	@release = release
end

def close(error = nil)

Close the upstream body and release its backend exchange.

Signature

parameter error Exception | Nil

The error which caused the body to close.

Implementation

def close(error = nil)
	super
ensure
	if release = @release
		@release = nil
		release.call
	end
end