Class: Volt::HttpRequest

Inherits:
Rack::Request
  • Object
show all
Defined in:
lib/volt/server/rack/http_request.rb

Overview

A request object for a HttpController. See Rack::Request for more details

Instance Method Summary collapse

Instance Method Details

#formatObject

Returns the request format /acticles/index.html => html Defaults to the media_type of the request



10
11
12
# File 'lib/volt/server/rack/http_request.rb', line 10

def format
  path_format || media_type
end

#methodObject

Returns the request method Allows requests to override the http request method by setting _method



22
23
24
25
26
27
28
# 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

#paramsObject

The request params with symbolized keys



31
32
33
# File 'lib/volt/server/rack/http_request.rb', line 31

def params
  super.symbolize_keys
end

#pathObject

Returns the path_info without the format /blub/index.html => /blub/index



16
17
18
# 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