-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
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
Support Starlette/FastAPI app.host
#4157
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #4157 +/- ##
==========================================
+ Coverage 79.57% 79.58% +0.01%
==========================================
Files 141 141
Lines 15711 15714 +3
Branches 2671 2671
==========================================
+ Hits 12502 12506 +4
Misses 2367 2367
+ Partials 842 841 -1
|
return route.path | ||
except AttributeError: | ||
# routes added via app.host() won't have a path attribute | ||
return scope.get("path") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] could we just use scope.get("path")
in all cases, instead? Or, are there times where route.path
is defined, but scope.get("path")
is not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, so I'm opting for the least invasive approach that will only affect host
routes to avoid potentially breaking existing functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough – I suppose we could look into this as a future improvement but tbh it's probs not worth much effort
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
In Starlette/FastAPI you're able to create subapps. When using
transaction_style="url"
in our integration, this would throw an exception because we try to accessroute.path
to determine the transaction name, butHost
routes have nopath
attribute.Closes #2631