Skip to content

build_virtual_host

faststream.rabbit.utils.build_virtual_host #

build_virtual_host(url, virtualhost, path)
Source code in faststream/rabbit/utils.py
def build_virtual_host(
    url: Union[str, "URL", None], virtualhost: Optional[str], path: str
) -> str:
    if (not url and not virtualhost) or virtualhost == "/":
        return ""
    elif virtualhost:
        return virtualhost.replace("/", "", 1)
    else:
        return path.replace("/", "", 1)