Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
V1.2.5 throws KeyError when API is misbehaving, 1.3.1 shares the same code #2572
At the time of writing, the API is having latency issues. Responses are still coming back, but content-type headers are missing which is causing a key error to raise rather than an internal server error.
I am aware I am using an outdated library version, but inspecting the source for 1.3.1, no mitigation has been made for this issue, so this will impact 1.3.1 as well.
No clue what the body is causing it, but it is being triggered by editing messages:
Corresponds to L164 on 4cf5f792d402fe8f6fea054c87da7f460a594aa0 in http.py
This has occurred three times within 10 minutes. Probably worth putting something in to check for this in the future and provide a meaningful exception instead to be safe.
I can't speak for aiohttp, but most sane HTTP implementations tend to use a tree map for HTTP headers with a case insensitive comparator. I know there is no treeset primitive in python, but aiohttp.typedefs.LooseHeaders should provide this functionality I would hope, so case sensitivity in HTTP headers should be ignored