π The fast, Pythonic way to build MCP servers and clients.
Keep an unparseable proxy setting from aborting the update check (#5639)
nate nowacke2fcc412001f
diff --git a/fastmcp_slim/fastmcp/utilities/version_check.py b/fastmcp_slim/fastmcp/utilities/version_check.pyindex 1db1121ff..e214aec48 100644--- a/fastmcp_slim/fastmcp/utilities/version_check.py+++ b/fastmcp_slim/fastmcp/utilities/version_check.py@@ -99,7 +99,7 @@ def _fetch_latest_version(include_prereleases: bool = False) -> str | None:return str(max(versions))- except (httpx2.HTTPError, json.JSONDecodeError, KeyError):+ except (httpx2.HTTPError, httpx2.InvalidURL, json.JSONDecodeError, KeyError):return Nonediff --git a/tests/utilities/test_version_check.py b/tests/utilities/test_version_check.pyindex 06069cee4..c499cb7bd 100644--- a/tests/utilities/test_version_check.py+++ b/tests/utilities/test_version_check.py@@ -131,6 +131,22 @@ class TestFetchLatestVersion:version = _fetch_latest_version()assert version is None+ def test_fetch_invalid_proxy_environment(self, monkeypatch: pytest.MonkeyPatch):+ """A proxy setting the HTTP client can't parse returns None (#5638)."""+ for key in (+ "HTTP_PROXY",+ "HTTPS_PROXY",+ "ALL_PROXY",+ "http_proxy",+ "https_proxy",+ "all_proxy",+ ):+ monkeypatch.delenv(key, raising=False)+ monkeypatch.setenv("NO_PROXY", "[::1]")+ monkeypatch.setenv("no_proxy", "[::1]")++ assert _fetch_latest_version() is None+def test_fetch_invalid_response(self):"""Invalid response returns None."""mock_response = MagicMock()