Skip to content

fix: Replace deprecated @app.route with app.add_route for Starlette 1.0 compatibility#279

Open
raynercodes wants to merge 4 commits into
laurentS:masterfrom
raynercodes:master
Open

fix: Replace deprecated @app.route with app.add_route for Starlette 1.0 compatibility#279
raynercodes wants to merge 4 commits into
laurentS:masterfrom
raynercodes:master

Conversation

@raynercodes

Copy link
Copy Markdown

Fixes #271

Problem

Starlette 1.0 removed the @app.route() decorator. Tests and documentation examples using this pattern throw:
AttributeError: 'Starlette' object has no attribute 'route'

Changes

  • Updated tests/test_starlette_extension.py to use app.add_route() instead of @app.route() decorator
  • Updated docs/examples.md to reflect the new routing pattern

Testing

Before this fix: 12 tests failing with AttributeError
After this fix: 6 tests failing (pre-existing timestamp precision issue unrelated to this PR)

All previously passing tests continue to pass still.

Comment thread docs/examples.md Outdated
Update to examples.md to mirror project handler names

Co-authored-by: dotlambda <github@dotlambda.de>

@raynercodes raynercodes left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review — applied the suggestion.

@dotlambda

Copy link
Copy Markdown

You overlooked the other spots where you made the same mistake.

@raynercodes

Copy link
Copy Markdown
Author

I Fixed all remaining instances. I updated handler to the correct function names throughout your examples.md.

@antoine-crossbeam

Copy link
Copy Markdown

Hey @raynercodes any news on this one ? :)

@raynercodes

Copy link
Copy Markdown
Author

Hey @raynercodes any news on this one ? :)

Sorry for the late response I kept forgetting to message you back but I actually haven't heard back from the author he never did merge the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incompatibility with recent Starlette versions (missing app.route)

3 participants