| 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 72
72: def finish
73: @body = block if block_given?
74: if [204, 304].include?(status.to_i)
75: header.delete "Content-Type"
76: [status.to_i, header.to_hash, []]
77: else
78: body = @body || []
79: body = [body] if body.respond_to? :to_str
80: if body.respond_to?(:to_ary)
81: header["Content-Length"] = body.to_ary.
82: inject(0) { |len, part| len + Rack::Utils.bytesize(part) }.to_s
83: end
84: [status.to_i, header.to_hash, body]
85: end
86: end