HttpResponse._get_content shouldn't accept non-text types
|Reported by:||Aymeric Augustin||Owned by:||Aymeric Augustin|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
httpwrappers tests verify the behavior of constructs such as
HttpResponse([1,1,2,4,8]). This doesn't make any sense to me.
HttpResponse must convert its content to bytes. But when a
Content-Encoding is already set, it mustn't perform any encoding, so it can't go through a unicode representation.
Now, in Python 3,
bytes(3) == \x00\x00\x00. So I don't see any way to implement the construct above in Python 3 without special-casing integers.
Rather than explicitly hacking a meaningless behavior, I'd like to remove these tests and require that
HttpResponse be instantiated with a (byte)string or an iterable of (byte)strings.
I'm marking this as a release blocker because it causes a test failure under Python 3 (