class Rack::WebProfiler::Request

Public Instance Methods

body_string() click to toggle source

Get body has a String.

@return [String]

# File lib/rack/web_profiler/request.rb, line 16
def body_string
  @body.to_s
end
http_headers() click to toggle source

Get HTTP headers.

@return [Hash]

# File lib/rack/web_profiler/request.rb, line 7
def http_headers
  env.select { |k, _v| (k.start_with?("HTTP_") && k != "HTTP_VERSION") || k == "CONTENT_TYPE" }
    .collect { |k, v| [k.sub(/^HTTP_/, ""), v] }
    .collect { |k, v| [k.split("_").collect(&:capitalize).join("-"), v] }
end
raw() click to toggle source

Get full HTTP request in HTTP format.

@return [String]

# File lib/rack/web_profiler/request.rb, line 23
def raw
  headers = http_headers.map { |k, v| "#{k}: #{v}\r\n" }.join
  format "%s %s %s\r\n%s\r\n%s", request_method.upcase, fullpath, env["SERVER_PROTOCOL"], headers, body_string
end