mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-18 09:56:00 +08:00
Add the missing attribute django.http.response.StreamingHttpResponse.streaming . This is actually done by moving the attribute from HttpResponse to the base class HttpResponseBase. The real Django source code declares this attribute on HttpResponse and StreamingHttpResponse, however that's only because Django doesn't have type hints. The right place for the type hint is on the base class HttpResponseBase, since all instances of that base class are actually instances of HttpResponse or StreamingHttpResponse or a subclass of those two classes. So it's guaranteed that every HttpResponseBase instance has the attribute. Fixes bug #629.
This commit is contained in:
@@ -23,6 +23,7 @@ class ResponseHeaders(CaseInsensitiveMapping):
|
||||
|
||||
class HttpResponseBase(Iterable[Any]):
|
||||
status_code: int = ...
|
||||
streaming: bool = ...
|
||||
cookies: SimpleCookie = ...
|
||||
reason_phrase: str = ...
|
||||
charset: str = ...
|
||||
@@ -81,7 +82,6 @@ class HttpResponse(HttpResponseBase):
|
||||
test_server_port: str
|
||||
test_was_secure_request: bool
|
||||
xframe_options_exempt: bool
|
||||
streaming: bool = ...
|
||||
def __init__(self, content: object = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||
def serialize(self) -> bytes: ...
|
||||
__bytes__ = serialize
|
||||
|
||||
Reference in New Issue
Block a user