Class: Newark::Request
- Inherits:
-
Rack::Request
- Object
- Rack::Request
- Newark::Request
- Defined in:
- lib/newark/request.rb
Instance Method Summary collapse
- #body ⇒ Object
- #headers ⇒ Object
- #params ⇒ Object
- #path_info ⇒ Object
- #request_id ⇒ Object
- #uri ⇒ Object
Instance Method Details
#body ⇒ Object
23 24 25 |
# File 'lib/newark/request.rb', line 23 def body @body ||= @env['rack.input'].read end |
#headers ⇒ Object
27 28 29 |
# File 'lib/newark/request.rb', line 27 def headers @headers ||= original_headers end |
#params ⇒ Object
19 20 21 |
# File 'lib/newark/request.rb', line 19 def params @params ||= ActiveSupport::HashWithIndifferentAccess.new(super) end |
#path_info ⇒ Object
15 16 17 |
# File 'lib/newark/request.rb', line 15 def path_info @path_info ||= super == '/' ? super : super.sub(/\/$/, '') end |
#request_id ⇒ Object
31 32 33 34 |
# File 'lib/newark/request.rb', line 31 def request_id @env['action_dispatch.request_id'] || (@env['rack.request_id'] ||= headers['X-Request-Id'] || SecureRandom.uuid) end |
#uri ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/newark/request.rb', line 7 def uri uri = "#{scheme}://#{host_with_port}#{path_info}" uri << "?#{query_string}" unless query_string.empty? URI(uri) rescue URI::InvalidURIError URI(URI.escape(uri)) end |