Fix route discovery on starlette < 0.20.1#604
Merged
Conversation
5378e64 to
98b0f77
Compare
Pins FastAPI 0.70.0 (starlette 0.16.0) to reproduce and verify route discovery on older starlette versions.
starlette._utils.is_async_callable was introduced in 0.20.1. On older versions (e.g. 0.16.0 used by FastAPI 0.70.0) the ImportError caused an early return, skipping the post_response handler entirely. This meant routes were never recorded in heartbeats. Fall back to inspect.iscoroutinefunction when _utils is unavailable.
Document supported versions in README (starlette ^0.16, FastAPI ^0.70) and enforce via version_requirement on the on_import hooks.
Rename fastapi-old to fastapi-postgres-uvicorn-old to match the naming convention. Replace the minimal shell-injection app with a full postgres sample app identical to the other fastapi variants, including templates, SQL injection e2e tests, and route discovery assertions. Fix port conflict with django-asgi-uvicorn (8114 -> 8118).
a8a587a to
482736f
Compare
tomaisthorpe
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
starlette._utils.is_async_callablewas introduced in 0.20.1. On older versions (e.g. 0.16.0 used by FastAPI 0.70.0) the ImportError caused an early return, skipping the post_response handler entirely. This meant routes were never recorded in heartbeats.Fall back to inspect.iscoroutinefunction when _utils is unavailable.
Summary by Aikido
⚡ Enhancements
🐛 Bugfixes
More info