Ticket #6082: headers-keyword-update-6082-1.patch

File headers-keyword-update-6082-1.patch, 1.2 KB (added by Unit03, 6 years ago)
  • twisted/web/http_headers.py

    diff --git a/twisted/web/http_headers.py b/twisted/web/http_headers.py
    index f0790b9..f4f3242 100644
    a b from __future__ import division, absolute_import 
    1010
    1111from collections import MutableMapping
    1212
    13 from twisted.python.compat import comparable, cmp
     13from twisted.python.compat import comparable, cmp, StringType
    1414
    1515
    1616def _dashCapitalize(name):
    class _DictHeaders(MutableMapping): 
    5454        """
    5555        Set the given header.
    5656        """
     57        if isinstance(key, StringType):
     58            key = key.encode('ascii')
    5759        self._headers.setRawHeaders(key, [value])
    5860
    5961
  • twisted/web/test/test_http_headers.py

    diff --git a/twisted/web/test/test_http_headers.py b/twisted/web/test/test_http_headers.py
    index 7a12a06..3aabcba 100644
    a b class HeaderDictTests(TestCase): 
    560560        self.assertEqual(headers.getRawHeaders(b"foo"), [b"panda"])
    561561        self.assertEqual(headers.getRawHeaders(b"bar"), [b"marmot"])
    562562
    563     if _PY3:
    564         test_updateWithKeywords.skip = "Not yet supported on Python 3; see #6082."
    565 
    566563
    567564    def test_setdefaultMissing(self):
    568565        """