lib/appmap/rails/request_handler.rb in appmap-0.39.1 vs lib/appmap/rails/request_handler.rb in appmap-0.40.0
- old
+ new
@@ -45,12 +45,17 @@
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
+ def normalized_path(request, router = ::Rails.application.routes.router)
+ router.recognize request do |route, _|
+ app = route.app
+ next unless app.matches? request
+ return normalized_path request, app.rack_app.routes.router if app.engine?
+
+ return route.path.spec.to_s
+ end
end
end
class HTTPServerResponse < AppMap::Event::MethodReturnIgnoreValue
attr_accessor :status, :mime_type