[web] Add asserts to the raw header conversion functions
This API is terrible, but at least this might help us catch some errors
in our conversion definitions.
--- a/web/http_headers.py Fri Mar 07 11:19:24 2014 +0100
+++ b/web/http_headers.py Fri Mar 14 11:11:28 2014 +0100
@@ -1324,6 +1324,9 @@
h = self._headers.get(name, None)
r = self.handler.generate(name, h)
if r is not None:
+ assert isinstance(r, list)
+ for v in r:
+ assert isinstance(v, str)
self._raw_headers[name] = r
return r
@@ -1362,6 +1365,9 @@
Value should be a list of strings, each being one header of the
given name.
"""
+ assert isinstance(value, list)
+ for v in value:
+ assert isinstance(v, str)
name = name.lower()
self._raw_headers[name] = value
self._headers[name] = _RecalcNeeded