Skip to content

Commit e102e7d

Browse files
author
chiliu
committed
add unit test for Streamable HTTP Trailing Slash Compatibility
1 parent 10ccbbf commit e102e7d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/server/fastmcp/test_server.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,22 @@ async def test_starlette_routes_with_mount_path(self):
124124
mount_routes[0].path == "/messages"
125125
), "Mount route path should be /messages"
126126

127+
mcp = FastMCP()
128+
app = mcp.streamable_http_app()
129+
130+
# Find routes by type
131+
streamable_routes = [r for r in app.routes if isinstance(r, Route)]
132+
mount_routes = [r for r in app.routes if isinstance(r, Mount)]
133+
134+
# Verify routes exist
135+
assert len(streamable_routes) == 2, "Should have two streamable routes"
136+
137+
# Verify path values
138+
assert streamable_routes[0].path == "/mcp", "Streamable route path should be /mcp"
139+
assert streamable_routes[1].path == "/mcp/", "Streamable route path should be /mcp"
140+
141+
142+
127143
@pytest.mark.anyio
128144
async def test_non_ascii_description(self):
129145
"""Test that FastMCP handles non-ASCII characters in descriptions correctly"""

0 commit comments

Comments
 (0)