Fix duplicate headers when dispatching WebHooks.
Review Request #11613 — Created May 24, 2021 and submitted — Latest diff uploaded
When building a request during WebHook dispatch, we were using legacy
byte strings for headers. This almost sort of worked on Python 3, except
that duplicateContent-Type
andContent-Length
headers would appear,
and this would generally break request handling on the target server.We needed to use native strings instead, to get the right behavior on
Python 2 and 3. This change updates request building to do this
correctly, and to updates tests to properly check the headers against
the right types.
Unit tests pass on Python 2.7 and 3.x.
Confirmed the bug against a WebHook endpoint on requestbin.net, and
confirmed the fix worked against the same endpoint, without any
duplicate headers.