lib/appmap/rails/request_handler.rb in appmap-0.38.1 vs lib/appmap/rails/request_handler.rb in appmap-0.39.0
- old
+ new
@@ -5,16 +5,17 @@
module AppMap
module Rails
module RequestHandler
class HTTPServerRequest < AppMap::Event::MethodEvent
- attr_accessor :request_method, :path_info, :params
+ attr_accessor :normalized_path_info, :request_method, :path_info, :params
def initialize(request)
super AppMap::Event.next_id_counter, :call, Thread.current.object_id
@request_method = request.request_method
+ @normalized_path_info = normalized_path request
@path_info = request.path_info.split('?')[0]
# ActionDispatch::Http::ParameterFilter is deprecated
parameter_filter_cls = \
if defined?(ActiveSupport::ParameterFilter)
ActiveSupport::ParameterFilter
@@ -26,12 +27,13 @@
def to_h
super.tap do |h|
h[:http_server_request] = {
request_method: request_method,
- path_info: path_info
- }
+ path_info: path_info,
+ normalized_path_info: normalized_path_info
+ }.compact
h[:message] = params.keys.map do |key|
val = params[key]
{
name: key,
@@ -39,9 +41,16 @@
value: self.class.display_string(val),
object_id: val.__id__
}
end
end
+ end
+
+ private
+
+ def normalized_path(request)
+ route = ::Rails.application.routes.router.enum_for(:recognize, request).first
+ route.first.path.spec.to_s if route
end
end
class HTTPServerResponse < AppMap::Event::MethodReturnIgnoreValue
attr_accessor :status, :mime_type