You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cookie support. You don't have to care about parsing or how to store them. [Example.](#cookies)
170
+
**Note:** If you provide this option, `options.headers.cookie` will be overridden.
171
171
172
-
**Note:**`options.headers.cookie` will be overridden.
172
+
Cookie support. You don't have to care about parsing or how to store them. [Example.](#cookies)
173
173
174
174
###### encoding
175
175
@@ -183,25 +183,23 @@ Default: `'utf8'`
183
183
Type: `boolean`<br>
184
184
Default: `false`
185
185
186
-
*If you provide this option, `got.stream()` will be read-only.*
186
+
**Note:** If you provide this option, `got.stream()` will be read-only.
187
+
**Note:**`body` must be a plain object. It will be converted to a query string using [`(new URLSearchParams(object)).toString()`](https://nodejs.org/api/url.html#url_constructor_new_urlsearchparams_obj).
187
188
188
189
If set to `true` and `Content-Type` header is not set, it will be set to `application/x-www-form-urlencoded`.
189
190
190
-
`body` must be a plain object. It will be converted to a query string using [`(new URLSearchParams(object)).toString()`](https://nodejs.org/api/url.html#url_constructor_new_urlsearchparams_obj).
191
-
192
191
###### json
193
192
194
193
Type: `boolean`<br>
195
194
Default: `false`
196
195
197
-
*If you use `got.stream()`, this option will be ignored.*
196
+
**Note:** If you use `got.stream()`, this option will be ignored.
197
+
**Note:**`body` must be a plain object or array and will be stringified.
198
198
199
199
If set to `true` and `Content-Type` header is not set, it will be set to `application/json`.
200
200
201
201
Parse response body with `JSON.parse` and set `accept` header to `application/json`. If used in conjunction with the `form` option, the `body` will the stringified as querystring and the response parsed as JSON.
202
202
203
-
`body` must be a plain object or array and will be stringified.
@@ -270,7 +268,7 @@ Delays between retries counts with function `1000 * Math.pow(2, retry) + Math.ra
270
268
271
269
The `retries` property can be a `number` or a `function` with `retry` and `error` arguments. The function must return a delay in milliseconds (`0` return value cancels retry).
272
270
273
-
**Note:**By default, it retries *only* on the specified methods, status codes, and on these network errors:
271
+
By default, it retries *only* on the specified methods, status codes, and on these network errors:
274
272
-`ETIMEDOUT`: One of the [timeout](#timeout) limits were reached.
275
273
-`ECONNRESET`: Connection was forcibly closed by a peer.
276
274
-`EADDRINUSE`: Could not bind to any free port.
@@ -362,7 +360,7 @@ Called with [normalized](source/normalize-arguments.js) [request options](#optio
362
360
363
361
See the [AWS section](#aws) for an example.
364
362
365
-
**Note**: If you modify the `body` you will need to modify the `content-length` header too, because it has already been computed and assigned.
363
+
**Note:** If you modify the `body` you will need to modify the `content-length` header too, because it has already been computed and assigned.
366
364
367
365
###### hooks.beforeRedirect
368
366
@@ -502,7 +500,7 @@ The object contains the following properties:
502
500
- `download` - `timings.end - timings.response`
503
501
- `total` - `timings.end - timings.start` or `timings.error - timings.start`
504
502
505
-
**Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
503
+
**Note:** The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
506
504
507
505
##### fromCache
508
506
@@ -524,7 +522,7 @@ The number of times the request was retried.
524
522
525
523
#### Streams
526
524
527
-
**Note**: Progress events, redirect events and request/response events can also be used with promises.
525
+
**Note:** Progress events, redirect events and request/response events can also be used with promises.
528
526
529
527
#### got.stream(url, [options])
530
528
@@ -536,7 +534,7 @@ Returns a [duplex stream](https://nodejs.org/api/stream.html#stream_class_stream
536
534
537
535
`request` event to get the request object of the request.
538
536
539
-
**Tip**: You can use `request` event to abort request:
537
+
**Tip:** You can use `request` event to abort request:
540
538
541
539
```js
542
540
got.stream('github.com')
@@ -639,7 +637,7 @@ client.get('/demo');
639
637
})();
640
638
```
641
639
642
-
*Need more control over the behavior of Got? Check out the [`got.create()`](advanced-creation.md).*
640
+
**Tip:**Need more control over the behavior of Got? Check out the [`got.create()`](advanced-creation.md).
643
641
644
642
#### got.mergeOptions(parentOptions, newOptions)
645
643
@@ -1015,7 +1013,7 @@ const custom = got.extend({
1015
1013
})();
1016
1014
```
1017
1015
1018
-
*Need to merge some instances into a single one? Check out [`got.mergeInstances()`](advanced-creation.md#merging-instances).*
1016
+
**Tip:**Need to merge some instances into a single one? Check out [`got.mergeInstances()`](advanced-creation.md#merging-instances).
0 commit comments