A straightforward use of a series of request.write()s with a request.finish() in the render_GET() method of a resource defaults to chunked encoding. I can avoid the chunked encoding by computing the entire response first using a StringIO (as shown below) and explicitly putting the "Content-Length" header in myself.
Is this the best (or recommended) way to create such a response?
Thx - Tom
=============
class myresource(Resource):
def render_GET(self, response):
output = StringIO.StringIO()
output.write("...")
output.write("...")
...
data = output.getvalue()
output.close()
# Write the response data. "content-length" suppresses chunked coding
request.setHeader('content-length', len(data))
request.write(data)
request.finish()
return True