Class: Sinatra::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/logjam_agent/rack/sinatra_request.rb

Overview

Extend the Sinatra Request class with some methods to make it look more like an ActionDispatch request.

Constant Summary collapse

KV_RE =
'[^&;=]+'
PAIR_RE =
%r{(#{KV_RE})=(#{KV_RE})}

Instance Method Summary collapse

Instance Method Details

#filtered_pathObject



23
24
25
26
27
28
29
30
# File 'lib/logjam_agent/rack/sinatra_request.rb', line 23

def filtered_path
  return path if query_string.empty?
  filter = parameter_filter
  filtered_query_string = query_string.gsub(PAIR_RE) do |_|
    filter.filter($1 => $2).first.join("=")
  end
  "#{path}?#{filtered_query_string}"
end

#parameter_filterObject



16
17
18
# File 'lib/logjam_agent/rack/sinatra_request.rb', line 16

def parameter_filter
  ActiveSupport::ParameterFilter.new(LogjamAgent.parameter_filters)
end

#query_parametersObject



13
# File 'lib/logjam_agent/rack/sinatra_request.rb', line 13

def query_parameters; self.GET; end

#request_parametersObject



14
# File 'lib/logjam_agent/rack/sinatra_request.rb', line 14

def request_parameters; self.POST; end