Files
django-stubs/tests/typecheck/views
Terence Honles 799b41fe47 fix typing on HttpResponse and StreamingHttpResponse (#712)
While the documentation for `HttpResponse` and `StreamingHttpResponse`
*says* `content` and `streaming_content` should be bytestrings [1] or an
iterable of bytestrings respectively [2], this is not what the API
supports [3] [4] and there are tests which make sure the API supports
more than bytestrings [5] [6] [etc]. Before assigning `content` or
`streaming_content` the code paths will call  `self.make_bytes` to
coerce the value to bytes.

[1]: https://github.com/django/django/blob/ecf87ad513fd8af6e4a6093ed918723a7d88d5ca/django/http/response.py#L324-L327
[2]: https://github.com/django/django/blob/0a28b42b1510b8093a90718bafd7627ed67fa13b/django/http/response.py#L395-L399
[3]: https://github.com/django/django/blob/ecf87ad513fd8af6e4a6093ed918723a7d88d5ca/django/http/response.py#L342-L362
[4]: https://github.com/django/django/blob/0a28b42b1510b8093a90718bafd7627ed67fa13b/django/http/response.py#L415-L427
[5]: https://github.com/django/django/blob/0a28b42b1510b8093a90718bafd7627ed67fa13b/tests/cache/tests.py#L2250
[6]: https://github.com/django/django/blob/0a28b42b1510b8093a90718bafd7627ed67fa13b/tests/i18n/urls.py#L8
2021-09-10 23:18:20 +03:00
..