module Sinatra::Helpers

def body(value = nil, &block)

evaluation is deferred until the body is read with #each.
Set or retrieve the response body. When a block is given,
def body(value = nil, &block)
  if block_given?
    def block.each; yield(call) end
    response.body = block
  elsif value
    unless request.head? || value.is_a?(Rack::Files::BaseIterator) || value.is_a?(Stream)
      headers.delete 'content-length'
    end
    response.body = value
  else
    response.body
  end
end