class Rack::MockResponse

def body

def body
  return @buffered_body if defined?(@buffered_body)
  # FIXME: apparently users of MockResponse expect the return value of
  # MockResponse#body to be a string.  However, the real response object
  # returns the body as a list.
  #
  # See spec_showstatus.rb:
  #
  #   should "not replace existing messages" do
  #     ...
  #     res.body.should == "foo!"
  #   end
  buffer = @buffered_body = String.new
  @body.each do |chunk|
    buffer << chunk
  end
  return buffer
end