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
- CONTENT_HEADERS =
%w(CONTENT_TYPE CONTENT_LENGTH).freeze
- IP_HEADERS =
[ "REMOTE_ADDR", "HTTP_CLIENT_IP", "HTTP_X_REAL_IP", "HTTP_X_FORWARDED_FOR" ].freeze
- MAX_BODY_LIMIT =
See Sentry server default limits at github.com/getsentry/sentry/blob/master/src/sentry/conf/server.py
4096 * 4
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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(req) ⇒ RequestInterface
constructor
A new instance of RequestInterface.
Methods inherited from Interface
inherited, registered, #to_hash
Constructor Details
#initialize(req) ⇒ RequestInterface
Returns a new instance of RequestInterface.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/sentry/interfaces/request.rb', line 37 def initialize(req) env = req.env if Sentry.configuration.send_default_pii self.data = read_data_from(req) self. = req. end self.url = req.scheme && req.url.split('?').first self.method = req.request_method self.query_string = req.query_string self.headers = filter_and_format_headers(env) self.env = filter_and_format_env(env) end |
Instance Attribute Details
#cookies ⇒ Object
Returns the value of attribute cookies.
18 19 20 |
# File 'lib/sentry/interfaces/request.rb', line 18 def @cookies end |
#data ⇒ Object
Returns the value of attribute data.
18 19 20 |
# File 'lib/sentry/interfaces/request.rb', line 18 def data @data end |
#env ⇒ Object
Returns the value of attribute env.
18 19 20 |
# File 'lib/sentry/interfaces/request.rb', line 18 def env @env end |
#headers ⇒ Object
Returns the value of attribute headers.
18 19 20 |
# File 'lib/sentry/interfaces/request.rb', line 18 def headers @headers end |
#method ⇒ Object
Returns the value of attribute method.
18 19 20 |
# File 'lib/sentry/interfaces/request.rb', line 18 def method @method end |
#query_string ⇒ Object
Returns the value of attribute query_string.
18 19 20 |
# File 'lib/sentry/interfaces/request.rb', line 18 def query_string @query_string end |
#url ⇒ Object
Returns the value of attribute url.
18 19 20 |
# File 'lib/sentry/interfaces/request.rb', line 18 def url @url end |
Class Method Details
.clean_env(env) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sentry/interfaces/request.rb', line 26 def self.clean_env(env) unless Sentry.configuration.send_default_pii # need to completely wipe out ip addresses RequestInterface::IP_HEADERS.each do |header| env.delete(header) end end env end |
.from_rack(env) ⇒ Object
20 21 22 23 24 |
# File 'lib/sentry/interfaces/request.rb', line 20 def self.from_rack(env) env = clean_env(env) req = ::Rack::Request.new(env) self.new(req) end |