Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ def _to_aiohttp_response(http_response: HttpResponse) -> Response:
return Response(
status=http_response.status_code,
headers=http_response.headers,
content_type=http_response.content_type,
)
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"InputFile",
"InputFileDownloader",
"Query",
"Route",
"_Route",
Comment thread
rodrigobr-msft marked this conversation as resolved.
"RouteHandler",
"TypingIndicator",
"Citation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -19,7 +19,7 @@ def method(self) -> str:
...

@property
def headers(self) -> dict[str, str]:
def headers(self) -> Mapping[str, str]:
"""Request headers."""
...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
"""HTTP response abstraction."""

from dataclasses import dataclass
from typing import Any, Optional
from typing import Any


@dataclass
class HttpResponse:
"""Framework-agnostic HTTP response."""

status_code: int
body: Optional[Any] = None
headers: Optional[dict[str, str]] = None
content_type: Optional[str] = "application/json"
body: Any | None = None
headers: dict[str, str] | None = None
content_type: str | None = "application/json"


class HttpResponseFactory:
Expand Down
Loading