Skip to content

Always get a CaseInsensitiveDict for headers. #5020

@kootenpv

Description

@kootenpv

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions