You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by pjknkda April 3, 2023
According to ASGI specification, scope["client"] for HTTP and Websocket protocol should have its host value in either IPv4 or IPv6 address formats.
However, in starlette/testclient.py, the _TestClientTransport set its host value to "testclient" and breaks applications that expect IPv4 or IPv6 address formats during tests.
Is it even possible to get the client IP, port at this stage when the request is not made? I think you could allow specifying the client IP, port but not get them when the request is not done (at least not in a reliable way)
And also the spec mentions: Optional; if missing defaults to None and I think that might make more sense when working with TestClient, because both of IP, Port in scope["client"] are invalid.
Discussed in #2109
Originally posted by pjknkda April 3, 2023
According to ASGI specification,
scope["client"]
for HTTP and Websocket protocol should have its host value in either IPv4 or IPv6 address formats.However, in
starlette/testclient.py
, the_TestClientTransport
set its host value to"testclient"
and breaks applications that expect IPv4 or IPv6 address formats during tests.starlette/starlette/testclient.py
Line 246 in f7bf741
starlette/starlette/testclient.py
Line 264 in f7bf741
Important
The text was updated successfully, but these errors were encountered: