Class: HttpLog::HttpRequest
- Inherits:
-
Rack::Request
- Object
- Rack::Request
- HttpLog::HttpRequest
- Defined in:
- lib/http_log/http_request.rb
Instance Method Summary collapse
Instance Method Details
#accepts ⇒ Object
3 4 5 |
# File 'lib/http_log/http_request.rb', line 3 def accepts Array.wrap(super).map(&:to_s) end |
#header_hash ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/http_log/http_request.rb', line 7 def header_hash header_keys = env.keys.select {|k| k =~ /HTTP_\w+/ } hash = {} header_keys.each do |key| hash[key] = env[key] end hash end |
#multi_part? ⇒ Boolean
26 27 28 |
# File 'lib/http_log/http_request.rb', line 26 def multi_part? content_type =~ /multipart/i end |
#params ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/http_log/http_request.rb', line 30 def params if content_type =~ /json/ && raw_post.present? super.merge(MultiJson.decode(raw_post) || {}) elsif content_type =~ /xml/ && raw_post.present? super.merge(Hash.from_xml(raw_post) || {}) else super end end |
#raw_post ⇒ Object
20 21 22 23 24 |
# File 'lib/http_log/http_request.rb', line 20 def raw_post result = body.read body.rewind result end |