Strip whitespace from endpoint URLs before use

Leading/trailing spaces in the endpoint field cause httpx to receive
a URL without a recognisable scheme, producing UnsupportedProtocol.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 20:06:35 +02:00
parent d74d1a74f8
commit bb2a4e2293
+2 -2
View File
@@ -280,7 +280,7 @@ async def handle_agent0_mcp(
from mcp.client.streamable_http import streamablehttp_client
from mcp import ClientSession
endpoint = (model.endpoint or "").rstrip("/")
endpoint = (model.endpoint or "").strip().rstrip("/")
mcp_key = model.mcp_key or ""
mcp_url = f"{endpoint}/mcp/t-{mcp_key}/http"
@@ -405,7 +405,7 @@ async def handle_hermes(
except ImportError:
from websockets.client import connect as ws_connect # type: ignore
endpoint = (model.endpoint or "").rstrip("/")
endpoint = (model.endpoint or "").strip().rstrip("/")
hermes_session_id = _hermes_sessions.get(req.conversation_id) if req.conversation_id else None
token = await _fetch_hermes_token(endpoint)