See: https://github.com/encode/httpx/pull/1312
()
| 174 | |
| 175 | @pytest.mark.anyio |
| 176 | async def test_basic_auth_with_stream() -> None: |
| 177 | """ |
| 178 | See: https://github.com/encode/httpx/pull/1312 |
| 179 | """ |
| 180 | url = "https://example.org/" |
| 181 | auth = ("user", "password123") |
| 182 | app = App() |
| 183 | |
| 184 | async with httpx.AsyncClient( |
| 185 | transport=httpx.MockTransport(app), auth=auth |
| 186 | ) as client: |
| 187 | async with client.stream("GET", url) as response: |
| 188 | await response.aread() |
| 189 | |
| 190 | assert response.status_code == 200 |
| 191 | assert response.json() == {"auth": "Basic dXNlcjpwYXNzd29yZDEyMw=="} |
| 192 | |
| 193 | |
| 194 | @pytest.mark.anyio |