We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add_url_rule
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)
add_url_rule works the same way for Flask and AsyncApp and connexion context can be used.
Currently to make it work
from starlette.requests import Request from starlette.responses import JSONResponse def healthz(request: Request): return JSONResponse({}, 200)
Add a custom rule using app.add_url_route
app.add_url_route
The text was updated successfully, but these errors were encountered:
@fcollonval incredibly minor typo, but it's starlette.requests, not starlette.request. Thanks for this fix.
starlette.requests
starlette.request
Sorry, something went wrong.
Good catch I updated the snippet.
No branches or pull requests
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_rule
works 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_route
Additional info:
The text was updated successfully, but these errors were encountered: