| Class | Sinatra::Response |
| In: |
lib/sinatra/base.rb
|
| Parent: | Rack::Response |
The response object. See Rack::Response and Rack::ResponseHelpers for more info: rack.rubyforge.org/doc/classes/Rack/Response.html rack.rubyforge.org/doc/classes/Rack/Response/Helpers.html
# File lib/sinatra/base.rb, line 57
57: def finish
58: @body = block if block_given?
59: if [204, 304].include?(status.to_i)
60: header.delete "Content-Type"
61: [status.to_i, header.to_hash, []]
62: else
63: body = @body || []
64: body = [body] if body.respond_to? :to_str
65: if body.respond_to?(:to_ary)
66: header["Content-Length"] = body.to_ary.
67: inject(0) { |len, part| len + Rack::Utils.bytesize(part) }.to_s
68: end
69: [status.to_i, header.to_hash, body]
70: end
71: end