server/sse: return response in handle_post_message #83
+11
−19
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.
Changes
SseServerTransport.handle_post_message
to returnResponse
objects instead of sending them directly via ASGIMotivation and Context
The current implementation directly sends ASGI responses, which breaks when used with Starlette because Starlette expects route handlers to return response objects. After the request is handled, Starlette tries to call the response object which currently fails because the
handle_post_message
method returns None:How Has This Been Tested?
Tested the change with this code running locally:
Breaking Changes
Technically, the change is breaking because it removes on of the unused parameter but it didn't work anyway.
Types of changes
Checklist
Additional context