@@ -389,7 +389,7 @@ Example:
389389 response.removeHeader("Content-Encoding");
390390
391391
392- ### response.write(chunk[ , encoding] )
392+ ### response.write(chunk[ , encoding] [ , callback ] )
393393
394394If this method is called and [ response.writeHead()] [ ] has not been called,
395395it will switch to implicit header mode and flush the implicit headers.
@@ -399,7 +399,8 @@ be called multiple times to provide successive parts of the body.
399399
400400` chunk ` can be a string or a buffer. If ` chunk ` is a string,
401401the second parameter specifies how to encode it into a byte stream.
402- By default the ` encoding ` is ` 'utf8' ` .
402+ By default the ` encoding ` is ` 'utf8' ` . The last parameter ` callback `
403+ will be called when this chunk of data is flushed.
403404
404405** Note** : This is the raw HTTP body and has nothing to do with
405406higher-level multi-part body encodings that may be used.
@@ -433,15 +434,15 @@ emit trailers, with a list of the header fields in its value. E.g.,
433434 response.end();
434435
435436
436- ### response.end([ data] [ , encoding ] )
437+ ### response.end([ data] [ , encoding ] [ , callback ] )
437438
438439This method signals to the server that all of the response headers and body
439440have been sent; that server should consider this message complete.
440441The method, ` response.end() ` , MUST be called on each
441442response.
442443
443- If ` data ` is specified, it is equivalent to calling ` response.write(data, encoding) `
444- followed by ` response.end() ` .
444+ If ` data ` is specified, it is equivalent to calling
445+ ` response.write(data, encoding) ` followed by ` response.end(callback ) ` .
445446
446447
447448## http.request(options[ , callback] )
@@ -864,7 +865,7 @@ That's usually what you want (it saves a TCP round-trip) but not when the first
864865data isn't sent until possibly much later. ` request.flush() ` lets you bypass
865866the optimization and kickstart the request.
866867
867- ### request.write(chunk[ , encoding] )
868+ ### request.write(chunk[ , encoding] [ , callback ] )
868869
869870Sends a chunk of the body. By calling this method
870871many times, the user can stream a request body to a
@@ -877,15 +878,17 @@ The `chunk` argument should be a [Buffer][] or a string.
877878The ` encoding ` argument is optional and only applies when ` chunk ` is a string.
878879Defaults to ` 'utf8' ` .
879880
881+ The ` callback ` argument is optional and will be called when this chunk of data
882+ is flushed.
880883
881- ### request.end([ data] [ , encoding ] )
884+ ### request.end([ data] [ , encoding ] [ , callback ] )
882885
883886Finishes sending the request. If any parts of the body are
884887unsent, it will flush them to the stream. If the request is
885888chunked, this will send the terminating ` '0\r\n\r\n' ` .
886889
887890If ` data ` is specified, it is equivalent to calling
888- ` request.write(data, encoding) ` followed by ` request.end() ` .
891+ ` request.write(data, encoding) ` followed by ` request.end(callback ) ` .
889892
890893### request.abort()
891894
0 commit comments