LennarbSourceLennarbRequest

class Request

Definitions

attr_reader :env

The environment variables of the request

Signature

returns Hash

def initialize(env, route_params = {})

Initialize the request object

Signature

returns Request

Implementation

def initialize(env, route_params = {})
  super(env)
  @route_params = route_params
end

def params

Get the request body

Signature

returns String

def path

Get the request path

Signature

returns String

def body

Read the body of the request

Signature

returns String

def query_params

Get the query parameters

Signature

returns Hash

Implementation

def query_params
  @query_params ||= Rack::Utils.parse_nested_query(query_string).transform_keys(&:to_sym)
end

def headers

Get the headers of the request

Implementation

def headers
  @headers ||= env.select { |key, _| key.start_with?('HTTP_') }
end