Skip to content

Commit d557952

Browse files
committed
feat(mcp): Fix 301 redirect
Issue:APPAI-154
1 parent df952fd commit d557952

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/gg_api_core/src/gg_api_core/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ async def _request(self, method: str, endpoint: str, **kwargs) -> Any:
432432

433433
while retry_count <= max_retries:
434434
try:
435-
async with httpx.AsyncClient() as client:
435+
async with httpx.AsyncClient(follow_redirects=True) as client:
436436
logger.debug(f"Sending {method} request to {url}")
437437
response = await client.request(method, url, headers=headers, **kwargs)
438438

@@ -652,7 +652,7 @@ async def _request_list(self, endpoint: str, **kwargs) -> ListResponse:
652652
}
653653
headers.update(kwargs.pop("headers", {}))
654654

655-
async with httpx.AsyncClient() as client:
655+
async with httpx.AsyncClient(follow_redirects=True) as client:
656656
response = await client.get(url, headers=headers, **kwargs)
657657
response.raise_for_status()
658658

packages/gg_api_core/src/gg_api_core/oauth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ async def redirect_handler(authorization_url: str) -> None:
690690
"User-Agent": f"MCP-Server/{self.token_name}", # Include in user agent
691691
}
692692

693-
async with httpx.AsyncClient() as client:
693+
async with httpx.AsyncClient(follow_redirects=True) as client:
694694
response = await client.post(token_url, data=token_params, headers=headers)
695695

696696
if response.status_code == 200:
@@ -763,7 +763,7 @@ async def _fetch_token_info(self) -> APITokenInfo | None:
763763
try:
764764
import httpx # Import here to avoid circular imports
765765

766-
async with httpx.AsyncClient() as client:
766+
async with httpx.AsyncClient(follow_redirects=True) as client:
767767
# Use the correct API endpoint with the full path
768768
response = await client.get(
769769
f"{self.api_url}/api_tokens/self",

0 commit comments

Comments
 (0)