response.removeHeader("Content-Encoding");
-### response.write(chunk[, encoding])
+### response.write(chunk[, encoding][, callback])
If this method is called and [response.writeHead()][] has not been called,
it will switch to implicit header mode and flush the implicit headers.
`chunk` can be a string or a buffer. If `chunk` is a string,
the second parameter specifies how to encode it into a byte stream.
-By default the `encoding` is `'utf8'`.
+By default the `encoding` is `'utf8'`. The last parameter `callback`
+will be called when this chunk of data is flushed.
**Note**: This is the raw HTTP body and has nothing to do with
higher-level multi-part body encodings that may be used.
response.end();
-### response.end([data][, encoding])
+### response.end([data][, encoding][, callback])
This method signals to the server that all of the response headers and body
have been sent; that server should consider this message complete.
The method, `response.end()`, MUST be called on each
response.
-If `data` is specified, it is equivalent to calling `response.write(data, encoding)`
-followed by `response.end()`.
+If `data` is specified, it is equivalent to calling
+`response.write(data, encoding)` followed by `response.end(callback)`.
## http.request(options[, callback])
data isn't sent until possibly much later. `request.flush()` lets you bypass
the optimization and kickstart the request.
-### request.write(chunk[, encoding])
+### request.write(chunk[, encoding][, callback])
Sends a chunk of the body. By calling this method
many times, the user can stream a request body to a
The `encoding` argument is optional and only applies when `chunk` is a string.
Defaults to `'utf8'`.
+The `callback` argument is optional and will be called when this chunk of data
+is flushed.
-### request.end([data][, encoding])
+### request.end([data][, encoding][, callback])
Finishes sending the request. If any parts of the body are
unsent, it will flush them to the stream. If the request is
chunked, this will send the terminating `'0\r\n\r\n'`.
If `data` is specified, it is equivalent to calling
-`request.write(data, encoding)` followed by `request.end()`.
+`request.write(data, encoding)` followed by `request.end(callback)`.
### request.abort()