REFACTOR API gateway fix 1

This commit is contained in:
Urtzi Alfaro
2025-07-26 19:15:18 +02:00
parent e4885db828
commit b0629c5971
3 changed files with 55 additions and 16 deletions

View File

@@ -59,7 +59,7 @@ class UserProxy:
try:
# Get auth service URL (with service discovery if available)
auth_url = await self._get_auth_service_url()
target_url = f"{auth_url}/api/v1/user/{path}"
target_url = f"{auth_url}/api/v1/users/{path}"
# Prepare headers (remove hop-by-hop headers)
headers = self._prepare_headers(dict(request.headers))
@@ -177,12 +177,12 @@ user_proxy = UserProxy()
@router.get("/me")
async def get_current_user(request: Request):
"""Proxy get current user to auth service"""
return await user_proxy.forward_request("GET", "/me", request)
return await user_proxy.forward_request("GET", "me", request)
@router.put("/me")
async def update_current_user(request: Request):
"""Proxy update current user to auth service"""
return await user_proxy.forward_request("PUT", "/me", request)
return await user_proxy.forward_request("PUT", "me", request)
# ================================================================
# CATCH-ALL ROUTE for any other user endpoints