Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

In finish(), test if chunk is None rather than using truthiness to de…

…cide

whether to call write().

This fixes a discrepancy between finish() and write() when outputting json.
Now both write({}) and finish({}) will output an empty json object.
  • Loading branch information...
commit 45f76c518eaf032c40fd39cc1384577742e5dd4d 1 parent 8637a73
Ben Darnell authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  tornado/web.py
2  tornado/web.py
@@ -463,7 +463,7 @@ def flush(self, include_footers=False):
463 463 def finish(self, chunk=None):
464 464 """Finishes this response, ending the HTTP request."""
465 465 assert not self._finished
466   - if chunk: self.write(chunk)
  466 + if chunk is not None: self.write(chunk)
467 467
468 468 # Automatically support ETags and add the Content-Length header if
469 469 # we have not flushed any content yet.

0 comments on commit 45f76c5

Please sign in to comment.
Something went wrong with that request. Please try again.