def body(value = nil)
if @async_running && (value || block_given?)
if block_given?
super { async_handle_exception { yield } }
else
super
end
if response.body.respond_to?(:call)
response.body = Array(async_handle_exception {response.body.call})
end
unless @response['Content-Type']
if Array === body and body[0].respond_to? :content_type
content_type body[0].content_type
else
content_type :html
end
end
result = response.finish
result[-1] = [] if request.head?
request.env['async.callback'][ result ]
body
else
super
end
end