Adding header name to exception

Adds the name of the header to the invalid header exception raised on TypeError.
This commit is contained in:
mgasvoda
2017-08-11 15:37:57 -04:00
committed by GitHub
parent 1c2022cf86
commit cee8fae65e
+2 -2
View File
@@ -868,8 +868,8 @@ def check_header_validity(header):
if not pat.match(value):
raise InvalidHeader("Invalid return character or leading space in header: %s" % name)
except TypeError:
raise InvalidHeader("Header value %s must be of type str or bytes, "
"not %s" % (value, type(value)))
raise InvalidHeader("Header %s value %s must be of type str or bytes, "
"not %s" % (name, value, type(value)))
def urldefragauth(url):