class Airbrake::Rack::RequestBodyFilter
A filter that appends Rack
request body to the notice.
@example
# Read and append up to 512 bytes from Rack request's body. Airbrake.add_filter(Airbrake::Rack::RequestBodyFilter.new(512))
@since v5.7.0 @note This filter is not used by default.
Attributes
weight[R]
@return [Integer]
Public Class Methods
new(length = 4096)
click to toggle source
@param [Integer] length The maximum number of bytes to read
# File lib/airbrake/rack/request_body_filter.rb, line 18 def initialize(length = 4096) @length = length @weight = 95 end
Public Instance Methods
call(notice)
click to toggle source
@see Airbrake::FilterChain#refine
# File lib/airbrake/rack/request_body_filter.rb, line 24 def call(notice) return unless (request = notice.stash[:rack_request]) return unless request.body notice[:environment][:body] = request.body.read(@length) request.body.rewind end