Class: Phaedra::Request

Inherits:
Rack::Request
  • Object
show all
Defined in:
lib/phaedra/rack_app.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



19
20
21
# File 'lib/phaedra/rack_app.rb', line 19

def [](key)
  header[key]
end

#bodyObject



23
24
25
# File 'lib/phaedra/rack_app.rb', line 23

def body
  @request_body ||= "" + get_header(Rack::RACK_INPUT).read
end

#headerObject



10
11
12
13
14
15
16
17
# File 'lib/phaedra/rack_app.rb', line 10

def header
  @transformed_headers ||= @env.dup.transform_keys do |key|
    key.respond_to?(:downcase) ? key.downcase : key
  end.tap do |headers|
    # TODO: normalize a few common headers
    headers["authorization"] = headers["http_authorization"]
  end
end

#queryObject



6
7
8
# File 'lib/phaedra/rack_app.rb', line 6

def query
  self.GET
end