summaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorNikolai Vavilov <vvnicholas@gmail.com>2013-11-28 22:25:30 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2013-11-28 22:31:11 +0100
commit207a3e10f8d91d996ef89c9ef10832d2277d03e9 (patch)
treecbc5388783c00ebd2a7fc13b986fd2f0b1476aec /doc/api
parent658aeb2ca0f7c99c002db149d6e91154ff0e2c2d (diff)
downloadnode-207a3e10f8d91d996ef89c9ef10832d2277d03e9.tar.gz
doc: http: properly document callback argument
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/http.markdown8
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/api/http.markdown b/doc/api/http.markdown
index 88f313dbf..882ea0f8c 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