replaced comparison for in operator

This commit is contained in:
Arnulfo Solis 2018-02-02 20:19:15 +01:00
parent f5a2d19199
commit f2c0489452

View File

@ -72,6 +72,8 @@ STATUS_CODES = {
511: b'Network Authentication Required' 511: b'Network Authentication Required'
} }
EMPTY_STATUS_CODES = [204, 304]
class BaseHTTPResponse: class BaseHTTPResponse:
def _encode_body(self, data): def _encode_body(self, data):
@ -198,7 +200,7 @@ class HTTPResponse(BaseHTTPResponse):
body = b'' body = b''
content_length = 0 content_length = 0
if self.status is not 204 and self.status != 304: if self.status not in EMPTY_STATUS_CODES:
body = self.body body = self.body
content_length = self.headers.get('Content-Length', len(self.body)) content_length = self.headers.get('Content-Length', len(self.body))