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

Methods

finish  

Public Instance methods

[Source]

    # File lib/sinatra/base.rb, line 50
50:     def finish
51:       @body = block if block_given?
52:       if [204, 304].include?(status.to_i)
53:         header.delete "Content-Type"
54:         [status.to_i, header.to_hash, []]
55:       else
56:         body = @body || []
57:         body = [body] if body.respond_to? :to_str
58:         if body.respond_to?(:to_ary)
59:           header["Content-Length"] = body.to_ary.
60:             inject(0) { |len, part| len + Rack::Utils.bytesize(part) }.to_s
61:         end
62:         [status.to_i, header.to_hash, body]
63:       end
64:     end

[Validate]