mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
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:
+1
-1
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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', {})
|
||||
|
||||
Reference in New Issue
Block a user