Rack::Response provides a convenient interface to create a Rack response.
It allows setting of headers and cookies, and provides useful
defaults (a OK response containing HTML).
You can use Response#write to iteratively generate your response,
but note that this is buffered by Rack::Response until you call
finish.
Alternatively, the method finish can take a block inside which calls to write
are synchronous with the Rack response.
Your application‘s call should end returning Response#finish.
Casiano Rodriguez León 2015-01-07