Am 01.12.2013 19:36, schrieb ilya-stromberg:
Code example:
void foo(HTTPServerRequest req, HTTPServerResponse res) { string str = `[1,2,3]`; res.statusCode = HTTPStatus.OK; res.headers["Content-Type"] = "application/json; charset=UTF-8"; res.bodyWriter.write(str); res.bodyWriter.flush(); }
Do I need to call
res.bodyWriter.flush
explicitly?
After foo
returns, everything is flushed/finalized automatically, so
it's useful only if there is going to be some more processing between
the last write
and returning from the function to reduce latency.