class ActionDispatch::Request

def route_uri_pattern

request.route_uri_pattern # => "/:controller(/:action(/:id))(.:format)"

using the same format as `bin/rails routes`:
Returns the URI pattern of the matched route for the request,
def route_uri_pattern
  get_header("action_dispatch.route_uri_pattern")
end