per-andersen commented on code in PR #74472:
URL: https://github.com/apache/airflow/pull/74472#discussion_r4280890320
##########
airflow-core/tests/unit/api_fastapi/execution_api/test_app.py:
##########
@@ -258,6 +258,39 @@ def test_in_process_execution_api_transport_lifecycle():
assert not thread.is_alive()
[email protected]("task_id", ["Købsmoms", "タスク"])
+def test_in_process_execution_api_handles_non_ascii_path(task_id):
+ """Non-ASCII path segments (e.g. a non-ASCII task_id) must reach the app
intact."""
+ app = FastAPI()
+
+ @app.get("/echo/{task_id}")
+ async def echo(task_id: str):
+ return task_id
+
+ api = InProcessExecutionAPI(app)
+ with httpx.Client(transport=api.transport) as client:
+ response = client.get(f"http://localhost/echo/{task_id}")
+ assert response.status_code == 200
+ assert response.json() == task_id
+
+
[email protected]("script_name", ["/Købsmoms", "/タスク"])
+def test_in_process_execution_api_handles_non_ascii_script_name(script_name):
+ """A non-ASCII ``SCRIPT_NAME`` must reach the app intact as the ASGI
``root_path``."""
+ app = FastAPI()
+
+ @app.get("/echo")
+ async def echo(request: Request):
+ return request.scope["root_path"]
+
+ api = InProcessExecutionAPI(app)
+ transport = httpx.WSGITransport(app=api.transport.app,
script_name=script_name)
Review Comment:
After updating the branch, `test_app.py` now imports only `httpx2`, which I
missed. I've switched the new tests to `httpx2`, matching the transport. Thanks
for catching that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]