Module: Honeybadger::Util::RequestPayload Private
- Defined in:
- lib/honeybadger/util/request_payload.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Constructs/sanitizes request data for notices
Constant Summary collapse
- DEFAULTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Default values to use for request data.
{ url: nil, component: nil, action: nil, params: {}.freeze, session: {}.freeze, cgi_data: {}.freeze }.freeze
- KEYS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Allowed keys.
DEFAULTS.keys.freeze
- HTTP_COOKIE_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The cgi_data key where the raw Cookie header is stored.
'HTTP_COOKIE'.freeze
Class Method Summary collapse
- .build(opts = {}) ⇒ Object private
Class Method Details
.build(opts = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/honeybadger/util/request_payload.rb', line 23 def self.build(opts = {}) sanitizer = opts.fetch(:sanitizer) { Sanitizer.new } payload = DEFAULTS.dup KEYS.each do |key| next unless opts[key] payload[key] = sanitizer.sanitize(opts[key]) end payload[:url] = sanitizer.filter_url(payload[:url]) if payload[:url] if payload[:cgi_data][HTTP_COOKIE_KEY] payload[:cgi_data][HTTP_COOKIE_KEY] = sanitizer.(payload[:cgi_data][HTTP_COOKIE_KEY]) end payload end |