From b86e347609f64c2a1c69e618bd2cb81d3f91a063 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Thu, 6 Feb 2025 10:40:35 +0300 Subject: [PATCH] fix: return error response if CAE claims are not present in WWW-Authenticate header --- packages/http/httpx/kiota_http/httpx_request_adapter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/http/httpx/kiota_http/httpx_request_adapter.py b/packages/http/httpx/kiota_http/httpx_request_adapter.py index 161fd77..e7c3b20 100644 --- a/packages/http/httpx/kiota_http/httpx_request_adapter.py +++ b/packages/http/httpx/kiota_http/httpx_request_adapter.py @@ -427,7 +427,7 @@ async def get_root_parse_node( def _should_return_none(self, response: httpx.Response) -> bool: """Helper function to check if the response should return None. - + Conditions: - The response status code is 204 or 304 - the response content is empty. @@ -629,7 +629,7 @@ async def retry_cae_response_if_required( ): claims_match = re.search('claims="([^"]+)"', auth_header_value) if not claims_match: - raise ValueError("Unable to parse claims from response") + return resp response_claims = claims_match.group(1) parent_span.add_event(AUTHENTICATE_CHALLENGED_EVENT_KEY) parent_span.set_attribute("http.retry_count", 1)