-
Notifications
You must be signed in to change notification settings - Fork 738
starlette/fastapi: fix error on host-based routing #3507
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,6 +207,7 @@ async def _(): | |
return {"message": "ok"} | ||
|
||
app.mount("/sub", app=sub_app) | ||
app.host("testserver2", sub_app) | ||
|
||
return app | ||
|
||
|
@@ -263,6 +264,10 @@ def test_sub_app_fastapi_call(self): | |
span.attributes[SpanAttributes.HTTP_URL], | ||
) | ||
|
||
def test_host_fastapi_call(self): | ||
client = TestClient(self._app, base_url="https://testserver2") | ||
client.get("/") | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should add some assertions here, especially for HTTP_ROUTE There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! The thing is I don't really understand how spans are working in the test above 😊 Can you give me a rough idea of how to start? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @frankie567 , some of the instrumentor tests are using a TestBase that can set up an in-memory span exporter. The test above uses this to get spans from an instrumented client then check its attributes. |
||
|
||
class TestBaseAutoFastAPI(TestBaseFastAPI): | ||
@classmethod | ||
|
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.
These needs to be moved to unreleased