class Rack::WebProfiler::Response
Public Class Methods
new(request, body = [], status = 200, headers = {})
click to toggle source
Initialize.
@param request [Rack::WebProfiler::Request] @param body [String, Array] @param status [Integer] @param headers [Hash]
Calls superclass method
# File lib/rack/web_profiler/response.rb, line 10 def initialize(request, body = [], status = 200, headers = {}) @request = request @version = "1.0" @version = "1.1" unless request.env["SERVER_PROTOCOL"] == "HTTP/1.0" super(body, status, headers) end
Public Instance Methods
raw()
click to toggle source
Get full HTTP response in HTTP format.
@return [String]
# File lib/rack/web_profiler/response.rb, line 21 def raw formated_headers = headers.map { |k, v| "#{k}: #{v}\r\n" }.join status_text = Rack::Utils::HTTP_STATUS_CODES[status] format "HTTP/%s %s %s\r\n%s\r\n%s", @version, status, status_text, formated_headers, body.join end