class Airbrake::Rack::HttpHeadersFilter
Adds HTTP request parameters.
@since v5.7.0
Constants
- HTTP_HEADER_PREFIXES
@return [Array<String>] the prefixes of the majority of HTTP headers in
Rack (some prefixes match the header names for simplicity)
Attributes
weight[R]
@return [Integer]
Public Class Methods
new()
click to toggle source
# File lib/airbrake/rack/http_headers_filter.rb, line 20 def initialize @weight = 98 end
Public Instance Methods
call(notice)
click to toggle source
@see Airbrake::FilterChain#refine
# File lib/airbrake/rack/http_headers_filter.rb, line 25 def call(notice) return unless (request = notice.stash[:rack_request]) http_headers = request.env.map.with_object({}) do |(key, value), headers| if HTTP_HEADER_PREFIXES.any? { |prefix| key.to_s.start_with?(prefix) } headers[key] = value end headers end notice[:context].merge!( httpMethod: request.request_method, referer: request.referer, headers: http_headers, ) end