Class: Sentry::RequestInterface
- Defined in:
- lib/sentry/interfaces/request.rb
Constant Summary collapse
- REQUEST_ID_HEADERS =
%w(action_dispatch.request_id HTTP_X_REQUEST_ID).freeze
- IP_HEADERS =
[ "REMOTE_ADDR", "HTTP_CLIENT_IP", "HTTP_X_REAL_IP", "HTTP_X_FORWARDED_FOR" ].freeze
Instance Attribute Summary collapse
-
#cookies ⇒ Object
Returns the value of attribute cookies.
-
#data ⇒ Object
Returns the value of attribute data.
-
#env ⇒ Object
Returns the value of attribute env.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#method ⇒ Object
Returns the value of attribute method.
-
#query_string ⇒ Object
Returns the value of attribute query_string.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #from_rack(env_hash) ⇒ Object
-
#initialize ⇒ RequestInterface
constructor
A new instance of RequestInterface.
Methods inherited from Interface
inherited, registered, #to_hash
Constructor Details
#initialize ⇒ RequestInterface
Returns a new instance of RequestInterface.
15 16 17 18 19 |
# File 'lib/sentry/interfaces/request.rb', line 15 def initialize self.headers = {} self.env = {} self. = nil end |
Instance Attribute Details
#cookies ⇒ Object
Returns the value of attribute cookies.
13 14 15 |
# File 'lib/sentry/interfaces/request.rb', line 13 def @cookies end |
#data ⇒ Object
Returns the value of attribute data.
13 14 15 |
# File 'lib/sentry/interfaces/request.rb', line 13 def data @data end |
#env ⇒ Object
Returns the value of attribute env.
13 14 15 |
# File 'lib/sentry/interfaces/request.rb', line 13 def env @env end |
#headers ⇒ Object
Returns the value of attribute headers.
13 14 15 |
# File 'lib/sentry/interfaces/request.rb', line 13 def headers @headers end |
#method ⇒ Object
Returns the value of attribute method.
13 14 15 |
# File 'lib/sentry/interfaces/request.rb', line 13 def method @method end |
#query_string ⇒ Object
Returns the value of attribute query_string.
13 14 15 |
# File 'lib/sentry/interfaces/request.rb', line 13 def query_string @query_string end |
#url ⇒ Object
Returns the value of attribute url.
13 14 15 |
# File 'lib/sentry/interfaces/request.rb', line 13 def url @url end |
Instance Method Details
#from_rack(env_hash) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/sentry/interfaces/request.rb', line 21 def from_rack(env_hash) req = ::Rack::Request.new(env_hash) if Sentry.configuration.send_default_pii self.data = read_data_from(req) self. = req. else # need to completely wipe out ip addresses IP_HEADERS.each { |h| env_hash.delete(h) } end self.url = req.scheme && req.url.split('?').first self.method = req.request_method self.query_string = req.query_string self.headers = format_headers_for_sentry(env_hash) self.env = format_env_for_sentry(env_hash) end |