| 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 54
54: def finish
55: @body = block if block_given?
56: if [204, 304].include?(status.to_i)
57: header.delete "Content-Type"
58: [status.to_i, header.to_hash, []]
59: else
60: body = @body || []
61: body = [body] if body.respond_to? :to_str
62: if body.respond_to?(:to_ary)
63: header["Content-Length"] = body.to_ary.
64: inject(0) { |len, part| len + Rack::Utils.bytesize(part) }.to_s
65: end
66: [status.to_i, header.to_hash, body]
67: end
68: end