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 /blub/index.html => html Defaults to the media_type of the request



12
13
14
# File 'lib/volt/server/rack/http_request.rb', line 12

def format
  path_format || media_type
end

#methodObject

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



24
25
26
27
28
29
30
# File 'lib/volt/server/rack/http_request.rb', line 24

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



33
34
35
# File 'lib/volt/server/rack/http_request.rb', line 33

def params
  super.symbolize_keys
end

#pathObject

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



18
19
20
# File 'lib/volt/server/rack/http_request.rb', line 18

def path
  path_format ? path_info[0..path_format.size * -1 - 2] : path_info
end