diff --git a/httpx/_client.py b/httpx/_client.py index 13cd933673..a570280d0a 100644 --- a/httpx/_client.py +++ b/httpx/_client.py @@ -234,6 +234,8 @@ def trust_env(self) -> bool: def _enforce_trailing_slash(self, url: URL) -> URL: if url.raw_path.endswith(b"/"): return url + if url.query: + return url.copy_with() return url.copy_with(raw_path=url.raw_path + b"/") def _get_proxy_map(