diff --git a/django-stubs/http/response.pyi b/django-stubs/http/response.pyi index 1804fed9e..91fc074c2 100644 --- a/django-stubs/http/response.pyi +++ b/django-stubs/http/response.pyi @@ -61,6 +61,8 @@ class HttpResponseBase(Iterable[Any]): def writelines(self, lines: Iterable[object]): ... def __iter__(self) -> Iterator[Any]: ... +JSONType = Union[Dict[str, 'JSONType'], List['JSONType'], int, str, float] + class HttpResponse(HttpResponseBase): client: Client context: Optional[Context] @@ -83,7 +85,7 @@ class HttpResponse(HttpResponseBase): def content(self, value: Any) -> None: ... @property def url(self) -> str: ... - def json(self) -> Dict[str, Any]: ... + def json(self) -> JSONType: ... class StreamingHttpResponse(HttpResponseBase): content: Any @@ -104,7 +106,7 @@ class FileResponse(StreamingHttpResponse): filename: str = ... def __init__(self, *args: Any, as_attachment: bool = ..., filename: str = ..., **kwargs: Any) -> None: ... def set_headers(self, filelike: BytesIO) -> None: ... - def json(self) -> Dict[str, Any]: ... + def json(self) -> JSONType: ... class HttpResponseRedirectBase(HttpResponse): allowed_schemes = ... # type: List[str]