mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-24 06:24:18 +02:00
Clean up code for creating the resource url (#1916)
This commit is contained in:
parent
0a8f8bbeb8
commit
fccd081758
2 changed files with 3 additions and 3 deletions
|
|
@ -1,7 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from mcp.server.auth.middleware.auth_context import AuthContextMiddleware
|
||||
from mcp.server.auth.middleware.bearer_auth import (
|
||||
|
|
@ -146,7 +145,9 @@ class AuthProvider(TokenVerifierProtocol):
|
|||
return None
|
||||
|
||||
if path:
|
||||
return AnyHttpUrl(f"{str(self.base_url).rstrip('/')}/{path.lstrip('/')}")
|
||||
prefix = str(self.base_url).rstrip("/")
|
||||
suffix = path.lstrip("/")
|
||||
return AnyHttpUrl(f"{prefix}/{suffix}")
|
||||
return self.base_url
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -239,7 +239,6 @@ class TestRemoteAuthProviderIntegration:
|
|||
("https://api.example.com", "https://api.example.com/mcp"),
|
||||
("https://api.example.com/", "https://api.example.com/mcp"),
|
||||
("https://api.example.com/v1/", "https://api.example.com/v1/mcp"),
|
||||
|
||||
],
|
||||
)
|
||||
async def test_base_url_configurations(self, base_url: str, expected_resource: str):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue