[v1.x] Route Context.report_progress() to the originating request stream (#2994)
This commit is contained in:
parent
777b8d0671
commit
9678a3b347
2 changed files with 10 additions and 3 deletions
|
|
@ -1177,6 +1177,7 @@ class Context(BaseModel, Generic[ServerSessionT, LifespanContextT, RequestT]):
|
||||||
progress=progress,
|
progress=progress,
|
||||||
total=total,
|
total=total,
|
||||||
message=message,
|
message=message,
|
||||||
|
related_request_id=self.request_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def read_resource(self, uri: str | AnyUrl) -> Iterable[ReadResourceContents]:
|
async def read_resource(self, uri: str | AnyUrl) -> Iterable[ReadResourceContents]:
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,12 @@ async def test_progress_token_zero_first_call():
|
||||||
|
|
||||||
# Verify progress notifications
|
# Verify progress notifications
|
||||||
assert mock_session.send_progress_notification.call_count == 3, "All progress notifications should be sent"
|
assert mock_session.send_progress_notification.call_count == 3, "All progress notifications should be sent"
|
||||||
mock_session.send_progress_notification.assert_any_call(progress_token=0, progress=0.0, total=10.0, message=None)
|
mock_session.send_progress_notification.assert_any_call(
|
||||||
mock_session.send_progress_notification.assert_any_call(progress_token=0, progress=5.0, total=10.0, message=None)
|
progress_token=0, progress=0.0, total=10.0, message=None, related_request_id="test-request"
|
||||||
mock_session.send_progress_notification.assert_any_call(progress_token=0, progress=10.0, total=10.0, message=None)
|
)
|
||||||
|
mock_session.send_progress_notification.assert_any_call(
|
||||||
|
progress_token=0, progress=5.0, total=10.0, message=None, related_request_id="test-request"
|
||||||
|
)
|
||||||
|
mock_session.send_progress_notification.assert_any_call(
|
||||||
|
progress_token=0, progress=10.0, total=10.0, message=None, related_request_id="test-request"
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue