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(&block) 73: if [204, 304].include?(status.to_i) 74: header.delete "Content-Type" 75: header.delete "Content-Length" 76: [status.to_i, header.to_hash, []] 77: else 78: body = block || @body || [] 79: body = [body] if String === body 80: if Array === body 81: header["Content-Length"] = body. 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