Class: Sentry::RequestInterface
- Defined in:
- lib/sentry/rack/interface.rb,
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.
13 14 15 16 17 |
# File 'lib/sentry/interfaces/request.rb', line 13 def initialize self.headers = {} self.env = {} self. = nil end |
Instance Attribute Details
#cookies ⇒ Object
Returns the value of attribute cookies.
11 12 13 |
# File 'lib/sentry/interfaces/request.rb', line 11 def end |
#data ⇒ Object
Returns the value of attribute data.
11 12 13 |
# File 'lib/sentry/interfaces/request.rb', line 11 def data @data end |
#env ⇒ Object
Returns the value of attribute env.
11 12 13 |
# File 'lib/sentry/interfaces/request.rb', line 11 def env @env end |
#headers ⇒ Object
Returns the value of attribute headers.
11 12 13 |
# File 'lib/sentry/interfaces/request.rb', line 11 def headers @headers end |
#method ⇒ Object
Returns the value of attribute method.
11 12 13 |
# File 'lib/sentry/interfaces/request.rb', line 11 def method @method end |
#query_string ⇒ Object
Returns the value of attribute query_string.
11 12 13 |
# File 'lib/sentry/interfaces/request.rb', line 11 def query_string @query_string end |
#url ⇒ Object
Returns the value of attribute url.
11 12 13 |
# File 'lib/sentry/interfaces/request.rb', line 11 def url @url end |
Instance Method Details
#from_rack(env_hash) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sentry/rack/interface.rb', line 3 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 |