diff --git a/twisted/web/http_headers.py b/twisted/web/http_headers.py
index f0790b9..1a93e18 100644
|
a
|
b
|
|
| 194 | 194 | |
| 195 | 195 | @return: C{None} |
| 196 | 196 | """ |
| | 197 | |
| 197 | 198 | if not isinstance(values, list): |
| 198 | 199 | raise TypeError("Header entry %r should be list but found " |
| 199 | 200 | "instance of %r instead" % (name, type(values))) |
| | 201 | |
| | 202 | if not all(isinstance(n, bytes) for n in name): |
| | 203 | raise TypeError("All header elements in %r must be bytes" % name ) |
| | 204 | |
| 200 | 205 | self._rawHeaders[name.lower()] = values |
| 201 | 206 | |
| 202 | 207 | |
diff --git a/twisted/web/test/test_http.py b/twisted/web/test/test_http.py
index f3f2dcc..cc59a23 100644
|
a
|
b
|
|
| 1375 | 1375 | "Passing non-bytes header values is deprecated since " |
| 1376 | 1376 | "Twisted 12.3. Pass only bytes instead.") |
| 1377 | 1377 | |
| | 1378 | def test_nonByteHeaderError(self): |
| | 1379 | """ |
| | 1380 | L{http.Request.write} casts non-bytes header value to bytes |
| | 1381 | transparently. |
| | 1382 | """ |
| | 1383 | req = http.Request(DummyChannel(), None) |
| | 1384 | |
| | 1385 | intlist = [int(1), int(2)] |
| | 1386 | err = self.assertRaises(TypeError, req.responseHeaders.setRawHeaders, intlist, [10]) |
| | 1387 | self.assertEqual(str(err), "All header elements in " + intlist.__str__() + " must be bytes") |
| 1378 | 1388 | |
| 1379 | 1389 | def test_firstWriteHTTP11Chunked(self): |
| 1380 | 1390 | """ |