From f2c0489452cd3bf2a5f2ba0af55f7346273e8e08 Mon Sep 17 00:00:00 2001 From: Arnulfo Solis Date: Fri, 2 Feb 2018 20:19:15 +0100 Subject: [PATCH] replaced comparison for in operator --- sanic/response.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sanic/response.py b/sanic/response.py index 26da64ae..9349ce81 100644 --- a/sanic/response.py +++ b/sanic/response.py @@ -72,6 +72,8 @@ STATUS_CODES = { 511: b'Network Authentication Required' } +EMPTY_STATUS_CODES = [204, 304] + class BaseHTTPResponse: def _encode_body(self, data): @@ -198,7 +200,7 @@ class HTTPResponse(BaseHTTPResponse): body = b'' content_length = 0 - if self.status is not 204 and self.status != 304: + if self.status not in EMPTY_STATUS_CODES: body = self.body content_length = self.headers.get('Content-Length', len(self.body))