module Sinatra::Helpers
def body(value = nil, &block)
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