[IMPR] Reduce code complexity of HttpRequest.header_encoding()
[IMPR] Reduce code complexity of HttpRequest.header_encoding()

Change-Id: Ie00cc6bba6b6f1edf02cb22a41387014206bb033

wikimedia/pywikibot-core,wikimedia/pywikibot-core