Accept AsyncIterable for responses

This commit is contained in:
CoolCat467 2024-11-18 12:55:14 -06:00 committed by David Lord
parent bfffe87d4c
commit 410e5ab7ed
No known key found for this signature in database
GPG key ID: 43368A7AA8CC5926
2 changed files with 6 additions and 0 deletions

View file

@ -6,6 +6,9 @@ Unreleased
- Fix type hint for `cli_runner.invoke`. :issue:`5645` - Fix type hint for `cli_runner.invoke`. :issue:`5645`
- ``flask --help`` loads the app and plugins first to make sure all commands - ``flask --help`` loads the app and plugins first to make sure all commands
are shown. :issue:5673` are shown. :issue:5673`
- Mark sans-io base class as being able to handle views that return
``AsyncIterable``. This is not accurate for Flask, but makes typing easier
for Quart. :pr:`5659`
Version 3.1.0 Version 3.1.0

View file

@ -1,5 +1,6 @@
from __future__ import annotations from __future__ import annotations
import collections.abc as cabc
import typing as t import typing as t
if t.TYPE_CHECKING: # pragma: no cover if t.TYPE_CHECKING: # pragma: no cover
@ -17,6 +18,8 @@ ResponseValue = t.Union[
t.Mapping[str, t.Any], t.Mapping[str, t.Any],
t.Iterator[str], t.Iterator[str],
t.Iterator[bytes], t.Iterator[bytes],
cabc.AsyncIterable[str], # for Quart, until App is generic.
cabc.AsyncIterable[bytes],
] ]
# the possible types for an individual HTTP header # the possible types for an individual HTTP header