class Rack::Lint::Wrapper

def close

#
# discards the response.
# cases where the Rack application makes internal/virtual requests and
# after the web server has sent the response to the client, but also in
# In other words, +close+ must always be called at least once; typically
# any resources associated with the generation of the body.
# Then, if the Body responds to +close+, it must be called to release
# optionally calling either +each+ or +call+.
# The Body must either be consumed or returned. The Body is consumed by
#
# +each+, then you can assume it responds to +call+.
# must call +each+ and not +call+. If the Body doesn't respond to
# Enumerable Body, not a Streaming Body. If it responds to +each+, you
# A Body that responds to both +each+ and +call+ must be treated as an
#
# to be a Streaming Body.
# to be an Enumerable Body. A Body that responds to +call+ is considered
# to +to_path+ or +to_ary+. A Body that responds to +each+ is considered
# The Body must respond to +each+ or +call+. It may optionally respond
#
# object.
# that yields +String+ instances, a +Proc+ instance, or a File-like
# The Body is typically an +Array+ of +String+ instances, an enumerable
#
# === The Body
#
# header. In HTTP/2, this is done by accepting the request.
# connection upgrade. In HTTP/1, this is done using the +upgrade+
# Setting this value informs the server that it should perform a
#
def close
  ##
  ## After calling +close+, the Body is considered closed and should not
  ## be consumed again.
  @closed = true
  ## If the original Body is replaced by a new Body, the new Body must
  ## also consume the original Body by calling +close+ if possible.
  @body.close if @body.respond_to?(:close)
  index = @lint.index(self)
  unless @env['rack.lint'][0..index].all? {|lint| lint.instance_variable_get(:@closed)}
    raise LintError, "Body has not been closed"
  end
end