public static function removeTrailingSlash($uri)
    {
        $uri = self::filterUri($uri);
        $path = $uri->getPath();
        if ('' !== $path && '/' === substr($path, -1)) {
            $path = substr($path, 0, -1);
        }

        return self::normalizePath($uri, $path);
    }