Class: Liberty::Adapters::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/liberty/adapters/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.



13
14
15
# File 'lib/liberty/adapters/request.rb', line 13

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

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



11
12
13
# File 'lib/liberty/adapters/request.rb', line 11

def env
  @env
end

Instance Method Details

#headersObject



17
18
19
20
21
22
# File 'lib/liberty/adapters/request.rb', line 17

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

#paramsObject



24
25
26
# File 'lib/liberty/adapters/request.rb', line 24

def params
  @params ||= env ? all_params : {}
end