Skip to content

Commit 045be5e

Browse files
test: add pytest coverage for SSE transport functions
1 parent babb477 commit 045be5e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Diff for: tests/shared/test_sse.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from starlette.routing import Mount, Route
1414

1515
from mcp.client.session import ClientSession
16-
from mcp.client.sse import sse_client
16+
from mcp.client.sse import sse_client, remove_request_params
1717
from mcp.server import Server
1818
from mcp.server.sse import SseServerTransport
1919
from mcp.shared.exceptions import McpError
@@ -250,3 +250,14 @@ async def test_sse_client_timeout(
250250
return
251251

252252
pytest.fail("the client should have timed out and returned an error already")
253+
254+
255+
def test_remove_request_params():
256+
# Removes query parameters
257+
assert remove_request_params('http://example.com/test?foo=bar') == 'http://example.com/test'
258+
# Removes fragment
259+
assert remove_request_params('http://example.com/test#section') == 'http://example.com/test'
260+
# Leaves clean URL unchanged
261+
assert remove_request_params('http://example.com/test') == 'http://example.com/test'
262+
# Works with path only
263+
assert remove_request_params('/test/path?x=1') == '/test/path'

0 commit comments

Comments
 (0)