make content-type's charset information case-insensitive

see issue https://github.com/requests/requests/issues/4748 for more information
This commit is contained in:
Lucy Linder
2018-07-24 18:13:50 +02:00
parent 6686ac1730
commit 907c927d60
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -466,7 +466,7 @@ def _parse_content_type_header(header):
if index_of_equals != -1:
key = param[:index_of_equals].strip(items_to_strip)
value = param[index_of_equals + 1:].strip(items_to_strip)
params_dict[key] = value
params_dict[key.lower()] = value
return content_type, params_dict
+4
View File
@@ -480,6 +480,10 @@ def test_parse_dict_header(value, expected):
'application/json ; charset=utf-8',
('application/json', {'charset': 'utf-8'})
),
(
'application/json ; Charset=utf-8',
('application/json', {'charset': 'utf-8'})
),
(
'text/plain',
('text/plain', {})