From 9f5877e0f7366290add639ab431a9abb3440d0d5 Mon Sep 17 00:00:00 2001 From: Rodrigo Brandao Date: Fri, 31 Jul 2026 11:38:38 -0700 Subject: [PATCH 1/2] Addressing issue --- .../microsoft_agents/hosting/aiohttp/cloud_adapter.py | 2 ++ .../microsoft_agents/hosting/core/__init__.py | 2 +- .../hosting/core/http/_http_request_protocol.py | 4 ++-- .../microsoft_agents/hosting/core/http/_http_response.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/cloud_adapter.py b/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/cloud_adapter.py index 17aef2f3..755e9852 100644 --- a/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/cloud_adapter.py +++ b/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/cloud_adapter.py @@ -64,8 +64,10 @@ def _to_aiohttp_response(http_response: HttpResponse) -> Response: data=http_response.body, status=http_response.status_code, headers=http_response.headers, + content_type=http_response.content_type or "application/json", ) return Response( status=http_response.status_code, headers=http_response.headers, + content_type=http_response.content_type or "application/json", ) diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/__init__.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/__init__.py index be36ce81..2b9e817f 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/__init__.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/__init__.py @@ -133,7 +133,7 @@ "InputFile", "InputFileDownloader", "Query", - "Route", + "_Route", "RouteHandler", "TypingIndicator", "Citation", diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_request_protocol.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_request_protocol.py index c3874987..0170c59f 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_request_protocol.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_request_protocol.py @@ -3,7 +3,7 @@ """Protocol for abstracting HTTP request objects across frameworks.""" -from typing import Protocol, Any, Optional +from typing import Protocol, Any, Optional, Mapping class HttpRequestProtocol(Protocol): @@ -19,7 +19,7 @@ def method(self) -> str: ... @property - def headers(self) -> dict[str, str]: + def headers(self) -> Mapping[str, str]: """Request headers.""" ... diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_response.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_response.py index b1a5dc46..6500b78c 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_response.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_response.py @@ -14,7 +14,7 @@ class HttpResponse: status_code: int body: Optional[Any] = None headers: Optional[dict[str, str]] = None - content_type: Optional[str] = "application/json" + content_type: str = "application/json" class HttpResponseFactory: From 0d70532a0e3c5a2778b0767ed4146880c93b9886 Mon Sep 17 00:00:00 2001 From: Rodrigo Brandao Date: Fri, 31 Jul 2026 11:59:49 -0700 Subject: [PATCH 2/2] Another commit --- .../microsoft_agents/hosting/aiohttp/cloud_adapter.py | 3 +-- .../microsoft_agents/hosting/core/http/_http_response.py | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/cloud_adapter.py b/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/cloud_adapter.py index 755e9852..234cd679 100644 --- a/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/cloud_adapter.py +++ b/libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/cloud_adapter.py @@ -64,10 +64,9 @@ def _to_aiohttp_response(http_response: HttpResponse) -> Response: data=http_response.body, status=http_response.status_code, headers=http_response.headers, - content_type=http_response.content_type or "application/json", ) return Response( status=http_response.status_code, headers=http_response.headers, - content_type=http_response.content_type or "application/json", + content_type=http_response.content_type, ) diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_response.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_response.py index 6500b78c..bfe1cab5 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_response.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/http/_http_response.py @@ -4,7 +4,7 @@ """HTTP response abstraction.""" from dataclasses import dataclass -from typing import Any, Optional +from typing import Any @dataclass @@ -12,9 +12,9 @@ class HttpResponse: """Framework-agnostic HTTP response.""" status_code: int - body: Optional[Any] = None - headers: Optional[dict[str, str]] = None - content_type: str = "application/json" + body: Any | None = None + headers: dict[str, str] | None = None + content_type: str | None = "application/json" class HttpResponseFactory: