Update http.py

This commit is contained in:
Jeremiah Lowin 2025-06-20 12:53:42 -04:00
commit ac95a3aaaf

View file

@ -157,9 +157,8 @@ def create_sse_app(
Returns:
A Starlette application with RequestContextMiddleware
"""
# Ensure the message_path ends with a trailing slash to avoid automatic redirects
# when mounting the application. sse_path uses Route instead of Mount so no fix needed.
if not message_path.endswith("/"):
message_path = message_path + "/"
@ -311,11 +310,10 @@ def create_streamable_http_app(
raise
# Ensure the streamable_http_path ends with a trailing slash to avoid automatic redirects
# when mounting the application
if not streamable_http_path.endswith("/"):
streamable_http_path = streamable_http_path + "/"
# Add StreamableHTTP routes with or without auth
# Add StreamableHTTP routes with or without auth
if auth:
auth_middleware, auth_routes, required_scopes = (
setup_auth_middleware_and_routes(auth)