Skip to content
Myr

Use more permissible types in ASGIApp (#3109)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Use the type.MutableMapping instead of Dict MutableMapping is a slightly more permissible type (allowing the previous Dict type) but matches up to Starlettes tpyes * Update CHANGELOG.md ---------

authored by Jon Finerty · committed by GitHub · parent 87713d2 · Browse files · 2 files+8 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Tom Christie <tom@tomchristie.com>

Diff stats

2 files+8 added−4 removed

  • other:+8 added−4 removed

2 files+8 added−4 removed

modified:httpx/_transports/asgi.py+4 added-4 removed
14 unmodified lines
1516 Event = typing.Union[asyncio.Event, trio.Event]171819_Message = typing.Dict[str, typing.Any]19_Message = typing.MutableMapping[str, typing.Any]20_Receive = typing.Callable[[], typing.Awaitable[_Message]]21_Send = typing.Callable[22 [typing.Dict[str, typing.Any]], typing.Coroutine[None, None, None]22 [typing.MutableMapping[str, typing.Any]], typing.Awaitable[None]23]24_ASGIApp = typing.Callable[25 [typing.Dict[str, typing.Any], _Receive, _Send], typing.Coroutine[None, None, None]25 [typing.MutableMapping[str, typing.Any], _Receive, _Send], typing.Awaitable[None]26]2728__all__ = ["ASGITransport"]29
110 unmodified lines
140 request_complete = True141 return {"type": "http.request", "body": b"", "more_body": False}142 return {"type": "http.request", "body": body, "more_body": True}143144 async def send(message: dict[str, typing.Any]) -> None:144 async def send(message: typing.MutableMapping[str, typing.Any]) -> None:145 nonlocal status_code, response_headers, response_started146147 if message["type"] == "http.response.start":148 assert not response_started
35 unmodified lines
modified:CHANGELOG.md+4 added
4 unmodified lines
5The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).67## Unreleased89### Fixed1011* Fix `app` type signature in `ASGITransport`. (#3109)1213## 0.27.0 (21st February, 2024)1415### Deprecated16
1073 unmodified lines