dvMountedLocation function

String dvMountedLocation(
  1. String path
)

The location to hand the router for Dartvel path: under the mount point when Dartvel serves the path, unchanged when it does not.

Implementation

String dvMountedLocation(String path) {
  if (_mountedAt == '/') return path;
  final Uri uri = Uri.parse(path);
  if (!uri.path.startsWith('/')) return path;
  final bool owned = _owned.any(
    (String pattern) => dvRoutesOverlap(uri.path, pattern),
  );
  if (!owned) return path;
  final String joined = uri.path == '/' ? _mountedAt : '$_mountedAt${uri.path}';
  return uri.replace(path: joined).toString();
}