| 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 38
38: def finish
39: @body = block if block_given?
40: if [204, 304].include?(status.to_i)
41: header.delete "Content-Type"
42: [status.to_i, header.to_hash, []]
43: else
44: body = @body || []
45: body = [body] if body.respond_to? :to_str
46: if body.respond_to?(:to_ary)
47: header["Content-Length"] = body.to_ary.
48: inject(0) { |len, part| len + Rack::Utils.bytesize(part) }.to_s
49: end
50: [status.to_i, header.to_hash, body]
51: end
52: end