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
bodyProtocol::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
errorException | 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