Description
The typing expected by starlette route callback is:
route: typing.Callable[[Request], typing.Awaitable[Response] | Response],
https://github.com/encode/starlette/blob/6f863b0d3b8e8f18d5df9e8cd2514f7085b874e1/starlette/applications.py#L161
So the example shown in the doc (that works for flask), does not work for AsyncApp
def healthz():
return 200
app.add_url_rule("/healthz", "healthz", healthz)
Expected behaviour
add_url_rule works the same way for Flask and AsyncApp and connexion context can be used.
Actual behaviour
Currently to make it work
from starlette.requests import Request
from starlette.responses import JSONResponse
def healthz(request: Request):
return JSONResponse({}, 200)
Steps to reproduce
Add a custom rule using app.add_url_route
Additional info:
- Python 3.10.13
- Connexion: 3.0.6
- starlette: 0.37.2
Description
The typing expected by starlette route callback is:
https://github.com/encode/starlette/blob/6f863b0d3b8e8f18d5df9e8cd2514f7085b874e1/starlette/applications.py#L161
So the example shown in the doc (that works for flask), does not work for AsyncApp
Expected behaviour
add_url_ruleworks the same way for Flask and AsyncApp and connexion context can be used.Actual behaviour
Currently to make it work
Steps to reproduce
Add a custom rule using
app.add_url_routeAdditional info: