Browse Source

[skip ci] add docs

deepak1556 8 years ago
parent
commit
8db1eacd1c
1 changed files with 22 additions and 0 deletions
  1. 22 0
      docs/api/client-request.md

+ 22 - 0
docs/api/client-request.md

@@ -29,6 +29,11 @@ the hostname and the port number 'hostname:port'
   * `hostname` String (optional) - The server host name.
   * `port` Integer (optional) - The server's listening port number.
   * `path` String (optional) - The path part of the request URL.
+  * `redirect` String (optional) - The redirect mode for this request. Should be
+one of `follow`, `error` or `manual`. Defaults to `follow`. When mode is `error`,
+any redirection will be aborted. When mode is `manual` the redirection will be
+deferred until [`request.followRedirect`](#requestfollowRedirect) is invoked. Listen for the [`redirect`](#event-redirect) event in
+this mode to get more details about the redirect request.
 
 `options` properties such as `protocol`, `host`, `hostname`, `port` and `path`
 strictly follow the Node.js model as described in the
@@ -121,6 +126,19 @@ Emitted as the last event in the HTTP request-response transaction. The `close`
 event indicates that no more events will be emitted on either the `request` or
 `response` objects.
 
+
+#### Event: 'redirect'
+
+Returns:
+
+* `statusCode` Integer
+* `method` String
+* `redirectUrl` String
+* `responseHeaders` Object
+
+Emitted when there is redirection and the mode is `manual`. Calling
+[`request.followRedirect`](#requestfollowRedirect) will continue with the redirection.
+
 ### Instance Properties
 
 #### `request.chunkedEncoding`
@@ -192,3 +210,7 @@ Cancels an ongoing HTTP transaction. If the request has already emitted the
 `close` event, the abort operation will have no effect. Otherwise an ongoing
 event will emit `abort` and `close` events. Additionally, if there is an ongoing
 response object,it will emit the `aborted` event.
+
+#### `request.followRedirect()`
+
+Continues any deferred redirection request when the redirection mode is `manual`.