def get_raw_path(request) -> str:
    """
    Returns the raw_path inside the request. The request can either be a Quart Request object (that
    encodes the raw path in request.scope['raw_path']) or a Werkzeug WSGi request (that encodes the
    raw path in request.environ['RAW_URI']).

    :param request: the request object
    :return: the raw path if any
    """
    if hasattr(request, "environ"):
        # werkzeug/flask request
        return request.environ.get("RAW_URI", request.path)

    if hasattr(request, "scope"):
        # quart request
        return request.scope.get("raw_path", request.path)

    raise ValueError("cannot extract raw path from request object %s" % request)