From: Nikolai Vavilov Date: Thu, 28 Nov 2013 20:25:30 +0000 (+0200) Subject: doc: http: properly document callback argument X-Git-Tag: v0.10.23~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=207a3e10f8d91d996ef89c9ef10832d2277d03e9;p=platform%2Fupstream%2Fnodejs.git doc: http: properly document callback argument --- diff --git a/doc/api/http.markdown b/doc/api/http.markdown index 88f313d..882ea0f 100644 --- a/doc/api/http.markdown +++ b/doc/api/http.markdown @@ -395,7 +395,7 @@ If `data` is specified, it is equivalent to calling `response.write(data, encodi followed by `response.end()`. -## http.request(options, callback) +## http.request(options, [callback]) Node maintains several connections per server to make HTTP requests. This function allows one to transparently issue requests. @@ -424,6 +424,9 @@ Options: - `false`: opts out of connection pooling with an Agent, defaults request to `Connection: close`. +The optional `callback` parameter will be added as a one time listener for +the ['response'][] event. + `http.request()` returns an instance of the [http.ClientRequest][] class. The `ClientRequest` instance is a writable stream. If one needs to upload a file with a POST request, then write to the `ClientRequest` object. @@ -478,7 +481,7 @@ There are a few special headers that should be noted. * Sending an Authorization header will override using the `auth` option to compute basic authentication. -## http.get(options, callback) +## http.get(options, [callback]) Since most requests are GET requests without bodies, Node provides this convenience method. The only difference between this method and `http.request()` @@ -867,6 +870,7 @@ authentication details. ['checkContinue']: #http_event_checkcontinue ['listening']: net.html#net_event_listening +['response']: #http_event_response [Agent]: #http_class_http_agent [Buffer]: buffer.html#buffer_buffer [EventEmitter]: events.html#events_class_events_eventemitter