If we look at how headers are merged from session and request, only if both are set the result will be a CaseInsensitiveDict. I propose to always use a case insensitive dict, even when one of the two is missing.
Expected Result
Always get a CaseInsensitiveDict for headers.
Actual Result
If only session.headers or request.headers are set, then headers are not case insensitive.
See also:
https://github.com/kennethreitz/requests/blob/master/requests/sessions.py#L55
I am not sure whether we should only do it isinstance(dict_class, CaseInsensitiveDict), or whether it would make sense to always convert to the dict_class.
If we look at how headers are merged from session and request, only if both are set the result will be a
CaseInsensitiveDict. I propose to always use a case insensitive dict, even when one of the two is missing.Expected Result
Always get a
CaseInsensitiveDictfor headers.Actual Result
If only
session.headersorrequest.headersare set, then headers are not case insensitive.See also:
https://github.com/kennethreitz/requests/blob/master/requests/sessions.py#L55
I am not sure whether we should only do it
isinstance(dict_class, CaseInsensitiveDict), or whether it would make sense to always convert to thedict_class.