From ff0632001cde48e3f94ac7768422c2821aca034a Mon Sep 17 00:00:00 2001 From: aryeh Date: Sun, 16 Apr 2017 10:07:29 -0400 Subject: [PATCH] prevent crash for unknown response codes set text for unknown status code, otherwise when None is used exception occurs. --- sanic/response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sanic/response.py b/sanic/response.py index bebb8071..0fc3c575 100644 --- a/sanic/response.py +++ b/sanic/response.py @@ -210,7 +210,7 @@ class HTTPResponse(BaseHTTPResponse): # Speeds up response rate 6% over pulling from all status = COMMON_STATUS_CODES.get(self.status) if not status: - status = ALL_STATUS_CODES.get(self.status) + status = ALL_STATUS_CODES.get(self.status, b'UNKNOWN RESPONSE') return (b'HTTP/%b %d %b\r\n' b'Connection: %b\r\n'