Class: Navigable::Server::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/navigable/server/request.rb

Constant Summary collapse

PARSED_BODY =
'parsed_body'
ROUTER_PARAMS =
'router.params'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env = nil) ⇒ Request

Returns a new instance of Request.



11
12
13
# File 'lib/navigable/server/request.rb', line 11

def initialize(env = nil)
  @env = env
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



9
10
11
# File 'lib/navigable/server/request.rb', line 9

def env
  @env
end

Instance Method Details

#headersObject



15
16
17
18
19
20
# File 'lib/navigable/server/request.rb', line 15

def headers
  @headers ||= env ? {
    accept_media_types: accept_media_types,
    preferred_media_type: preferred_media_type
  } : {}
end

#paramsObject



22
23
24
# File 'lib/navigable/server/request.rb', line 22

def params
  @params ||= env ? form_params.merge!(body_params).merge!(url_params) : {}
end