Make sure content_type is stripped of whitespace.

Otherwise the not_binary method will not match.

I considered stripping in not_binary but I think it is better that
it be strict in what it accepts.
This commit is contained in:
Chris Dent 2015-07-22 20:11:00 +01:00
parent 59ad05476a
commit 27eb9b2d89

@ -53,7 +53,8 @@ def decode_content(response, content):
'application/binary').strip().lower()
charset = 'utf-8'
if ';' in content_type:
content_type, parameter_strings = content_type.split(';', 1)
content_type, parameter_strings = (attr.strip() for attr
in content_type.split(';', 1))
try:
parameter_pairs = [atom.strip().split('=')
for atom in parameter_strings.split(';')]