kurtmckee/feedparser

Make feedparser accepts caseinsensitive headers

Closed this issue · 0 comments

Currently FeedParserDict's headers type is dict.

result = FeedParserDict(
bozo=False,
entries=[],
feed=FeedParserDict(),
headers={},
)

But while assigning response_headers which is type of CaseInsensitiveDict to headers it act like dict.

# overwrite existing headers using response_headers
result["headers"].update(response_headers or {})
try:

If this acts like this it's hard to parse Content-Type

HTTP/1.1 200 OK
Connection: keep-alive
Date: Sat, 30 Dec 2023 09:20:21 GMT
Content-Type: text/xml; charset=UTF-8
Transfer-Encoding: chunked

If it is expected behavior, how can I modify Content-Type overriding Http requester?

FYI: requests headers type is CaseInsensitiveDict
https://github.com/psf/requests/blob/72eccc8dd8b7c272e520f22b0256386c80864e94/src/requests/adapters.py#L293-L314