httpx 0.25.0 changes decoding behaviour of .query_params
when using TestClient
#2281
-
Hello. I'm not really sure if this is an issue with starlette or httpx. It kind of sits at the intersection between the two. Here''s a minimal example application:
from starlette.applications import Starlette
from starlette.responses import Response
from starlette.routing import Route
async def index(request):
foo = request.query_params.get("foo")
return Response(foo, status_code=200, media_type="text/html")
routes = [Route("/", endpoint=index)]
app = Starlette(debug=True, routes=routes) ..and here's a unit test (pytest):
from starlette.testclient import TestClient
from app import app
def test_foo():
client = TestClient(app)
response = client.get("/?foo=%3A/")
assert ":/" == response.text If I run that test with
installed, the test passes. Install
and run it again. The test now fails. The output is Note that the actual application behaviour is unchanged. i.e: when invoked independently of This seems like it could be related to encode/httpx#2844 but I decided to open a discussion specifically about the impact on starlette |
Beta Was this translation helpful? Give feedback.
#2282