Skip to content

Instantly share code, notes, and snippets.

@takai
Created October 28, 2014 05:51
Show Gist options
  • Save takai/e281459c73a2cd8b5c99 to your computer and use it in GitHub Desktop.
Save takai/e281459c73a2cd8b5c99 to your computer and use it in GitHub Desktop.
class ParameterFilterProcessor
def self.create(filters)
Class.new(Raven::Processor::Processor) do
@filters = filters
def initialize(client = nil)
@parameter_filter = ActionDispatch::Http::ParameterFilter.new(self.class.filters)
end
def process(value)
if value['request'] && value['request']['query_string'].present?
query = Rack::Utils.parse_query(value['request']['query_string'])
filtered = @parameter_filter.filter(query)
value['request']['query_string'] = Rack::Utils.build_query(filtered)
end
@parameter_filter.filter(value)
end
def self.filters
@filters
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment