diff --git a/tests/unit/test_server.py b/tests/unit/test_server.py index c7cc8cc..75b08fc 100644 --- a/tests/unit/test_server.py +++ b/tests/unit/test_server.py @@ -88,10 +88,13 @@ def check_response(self, handler): response = response.decode("utf8").replace("\n\n", "\n") result = {} - for line in response.splitlines(): - key = line.split(":", 1)[0].strip() - value = line.split(":")[1].strip() - result[key] = value + try: + for line in response.splitlines(): + key = line.split(":", 1)[0].strip() + value = line.split(":")[1].strip() + result[key] = value + except (IndexError, TypeError) as e: + self.fail("Error parsing %r: %s" % (response, e)) self.assertEqual(result, self.expected_response)