Skip to content

Commit

Permalink
Inline Response.should_send_body()
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Aug 24, 2016
1 parent 264fa99 commit 72bba0d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions aiohttp/web_reqrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,15 +846,13 @@ def text(self, text):

self.body = text.encode(self.charset)

def should_send_body(self):
return (self._req.method != hdrs.METH_HEAD and
self._status not in [204, 304])

@asyncio.coroutine
def write_eof(self):
try:
body = self._body
if body is not None and self.should_send_body():
if (body is not None and
self._req.method != hdrs.METH_HEAD and
self._status not in [204, 304]):
self.write(body)
finally:
self.set_tcp_nodelay(True)
Expand Down

0 comments on commit 72bba0d

Please sign in to comment.