From b2476bd7d76484576f8dc6d769ee796f10308970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=2E=20K=C3=A4rkk=C3=A4inen?= Date: Fri, 28 Feb 2020 17:26:31 +0200 Subject: [PATCH] Better testing error messages on protocol errors. --- sanic/testing.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sanic/testing.py b/sanic/testing.py index f4b297da..cb110cd3 100644 --- a/sanic/testing.py +++ b/sanic/testing.py @@ -40,6 +40,9 @@ class SanicTestClient: response = await getattr(session, method.lower())( url, verify=False, *args, **kwargs ) + except httpx.exceptions.ConnectionClosed: + logger.error(f"{method.upper()} {url} broken HTTP, response is None!") + return None except NameError: raise Exception(response.status_code)