### Fixed
* Allow URLs where username or password contains unescaped '@'. (#2986)
+* Ensure ASGI `raw_path` does not include URL query component. (#2999)
## 0.25.2 (24th November, 2023)
"headers": [(k.lower(), v) for (k, v) in request.headers.raw],
"scheme": request.url.scheme,
"path": request.url.path,
- "raw_path": request.url.raw_path,
+ "raw_path": request.url.raw_path.split(b"?")[0],
"query_string": request.url.query,
"server": (request.url.host, request.url.port),
"client": self.client,
assert response.json() == {"raw_path": "/user@example.org"}
+@pytest.mark.anyio
+async def test_asgi_raw_path_should_not_include_querystring_portion():
+ """
+ See https://github.com/encode/httpx/issues/2810
+ """
+ async with httpx.AsyncClient(app=echo_raw_path) as client:
+ url = httpx.URL("http://www.example.org/path?query")
+ response = await client.get(url)
+
+ assert response.status_code == 200
+ assert response.json() == {"raw_path": "/path"}
+
+
@pytest.mark.anyio
async def test_asgi_upload():
async with httpx.AsyncClient(app=echo_body) as client: