fix comments
This commit is contained in:
parent
554890a809
commit
b5788f6db1
12
README.md
12
README.md
|
@ -27,15 +27,13 @@ request('http://www.google.com', function (error, response, body) {
|
||||||
|
|
||||||
The first argument can be either a `url` or an `options` object. The only required option is `uri`; all others are optional.
|
The first argument can be either a `url` or an `options` object. The only required option is `uri`; all others are optional.
|
||||||
|
|
||||||
- `uri` || `url` - fully qualified uri or a parsed url object from `url.parse()`
|
- `uri` || `url` - fully qualified uri or a parsed url object from `url.parse()` <!-- TODO - `baseUrl` - fully qualified uri string used as the base url. Most useful with `request.defaults`, for example when you want to do many requests to the same domain. If `baseUrl` is `https://example.com/api/`, then requesting `/end/point?test=true` will fetch `https://example.com/api/end/point?test=true`. When `baseUrl` is given, `uri` must also be a string. -->
|
||||||
<!-- TODO - `baseUrl` - fully qualified uri string used as the base url. Most useful with `request.defaults`, for example when you want to do many requests to the same domain. If `baseUrl` is `https://example.com/api/`, then requesting `/end/point?test=true` will fetch `https://example.com/api/end/point?test=true`. When `baseUrl` is given, `uri` must also be a string. -->
|
|
||||||
- `method` - http method (default: `"GET"`)
|
- `method` - http method (default: `"GET"`)
|
||||||
- `headers` - http headers (default: `{}`)
|
- `headers` - http headers (default: `{}`)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
- `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer`, `String` or `ReadStream`. If `json` is `true`, then `body` must be a JSON-serializable object.
|
- `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer`, `String` or `ReadStream`. If `json` is `true`, then `body` must be a JSON-serializable object. <!--
|
||||||
<!--
|
|
||||||
- `form` - when passed an object or a querystring, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded` header. When passed no options, a `FormData` instance is returned (and is piped to request). See "Forms" section above.
|
- `form` - when passed an object or a querystring, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded` header. When passed no options, a `FormData` instance is returned (and is piped to request). See "Forms" section above.
|
||||||
- `formData` - data to pass for a `multipart/form-data` request. See
|
- `formData` - data to pass for a `multipart/form-data` request. See
|
||||||
[Forms](#forms) section above.
|
[Forms](#forms) section above.
|
||||||
|
@ -49,8 +47,7 @@ The first argument can be either a `url` or an `options` object. The only requir
|
||||||
- `preambleCRLF` - append a newline/CRLF before the boundary of your `multipart/form-data` request.
|
- `preambleCRLF` - append a newline/CRLF before the boundary of your `multipart/form-data` request.
|
||||||
- `postambleCRLF` - append a newline/CRLF at the end of the boundary of your `multipart/form-data` request.
|
- `postambleCRLF` - append a newline/CRLF at the end of the boundary of your `multipart/form-data` request.
|
||||||
-->
|
-->
|
||||||
- `json` - sets `body` to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON.
|
- `json` - sets `body` to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON. <!--
|
||||||
<!--
|
|
||||||
- `jsonReviver` - a [reviver function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) that will be passed to `JSON.parse()` when parsing a JSON response body.
|
- `jsonReviver` - a [reviver function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) that will be passed to `JSON.parse()` when parsing a JSON response body.
|
||||||
- `jsonReplacer` - a [replacer function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) that will be passed to `JSON.stringify()` when stringifying a JSON request body.
|
- `jsonReplacer` - a [replacer function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) that will be passed to `JSON.stringify()` when stringifying a JSON request body.
|
||||||
-->
|
-->
|
||||||
|
@ -65,8 +62,7 @@ The first argument can be either a `url` or an `options` object. The only requir
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
- `encoding` - encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`. Anything else **(including the default value of `undefined`)** will be passed as the [encoding](http://nodejs.org/api/buffer.html#buffer_buffer) parameter to `toString()` (meaning this is effectively `utf8` by default). (**Note:** if you expect binary data, you should set `encoding: null`.)
|
- `encoding` - encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`. Anything else **(including the default value of `undefined`)** will be passed as the [encoding](http://nodejs.org/api/buffer.html#buffer_buffer) parameter to `toString()` (meaning this is effectively `utf8` by default). (**Note:** if you expect binary data, you should set `encoding: null`.) <!--
|
||||||
<!--
|
|
||||||
- `gzip` - if `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response. **Note:** Automatic decoding of the response content is performed on the body data returned through `request` (both through the `request` stream and passed to the callback function) but is not performed on the `response` stream (available from the `response` event) which is the unmodified `http.IncomingMessage` object which may contain compressed data. See example below.
|
- `gzip` - if `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response. **Note:** Automatic decoding of the response content is performed on the body data returned through `request` (both through the `request` stream and passed to the callback function) but is not performed on the `response` stream (available from the `response` event) which is the unmodified `http.IncomingMessage` object which may contain compressed data. See example below.
|
||||||
- `jar` - if `true`, remember cookies for future use (or define your custom cookie jar; see examples section)
|
- `jar` - if `true`, remember cookies for future use (or define your custom cookie jar; see examples section)
|
||||||
-->
|
-->
|
||||||
|
|
Loading…
Reference in New Issue