class Volt::HttpRequest
A request object for a HttpController
. See Rack::Request for more details
Public Instance Methods
format()
click to toggle source
Returns the request format /acticles/index.html => html Defaults to the media_type of the request
# File lib/volt/server/rack/http_request.rb, line 10 def format path_format || media_type end
method()
click to toggle source
Returns the request method Allows requests to override the http request method by setting _method
# File lib/volt/server/rack/http_request.rb, line 22 def method if params[:_method] params[:_method].to_s.downcase.to_sym else request_method.downcase.to_sym end end
params()
click to toggle source
The request params with symbolized keys
Calls superclass method
# File lib/volt/server/rack/http_request.rb, line 31 def params super.symbolize_keys end
path()
click to toggle source
Returns the path_info without the format /blub/index.html => /blub/index
# File lib/volt/server/rack/http_request.rb, line 16 def path path_format ? path_info[0..path_format.size * -1 - 2] : path_info end
Private Instance Methods
extract_format_from_path()
click to toggle source
Extract from the path
# File lib/volt/server/rack/http_request.rb, line 45 def extract_format_from_path format = path_info.match(/\.(\w+)$/) format.present? ? format[1] : nil end
path_format()
click to toggle source
Returns the format given in the path_info example.com/test.html => html example.com/test => nil
# File lib/volt/server/rack/http_request.rb, line 40 def path_format @path_format ||= extract_format_from_path end