Skip to content

Commit 8341fba

Browse files
alextessindresorhus
authored andcommittedDec 26, 2018
Consistent use of emphasis in readme (#684)
* Consistent use of emphasis in readme * Escape asterisk * Remove Note from retry section * Consistent sentence structure for readme Note * Update readme.md * Update readme.md * bold colons * tips too * Update readme.md
1 parent 0bb9fa6 commit 8341fba

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed
 

‎readme.md

+16-18
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Returns a `Stream` instead of a `Promise`. This is equivalent to calling `got.st
155155

156156
Type: `string` `Buffer` `stream.Readable` [`form-data` instance](https://github.com/form-data/form-data)
157157

158-
*If you provide this option, `got.stream()` will be read-only.*
158+
**Note:** If you provide this option, `got.stream()` will be read-only.
159159

160160
The body that will be sent with a `POST` request.
161161

@@ -167,9 +167,9 @@ The `content-length` header will be automatically set if `body` is a `string` /
167167

168168
Type: [`tough.CookieJar` instance](https://github.com/salesforce/tough-cookie#cookiejar)
169169

170-
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.
171171

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)
173173

174174
###### encoding
175175

@@ -183,25 +183,23 @@ Default: `'utf8'`
183183
Type: `boolean`<br>
184184
Default: `false`
185185

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).
187188

188189
If set to `true` and `Content-Type` header is not set, it will be set to `application/x-www-form-urlencoded`.
189190

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-
192191
###### json
193192

194193
Type: `boolean`<br>
195194
Default: `false`
196195

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.
198198

199199
If set to `true` and `Content-Type` header is not set, it will be set to `application/json`.
200200

201201
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.
202202

203-
`body` must be a plain object or array and will be stringified.
204-
205203
###### query
206204

207205
Type: `string` `Object<string, string|number>` [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)
@@ -270,7 +268,7 @@ Delays between retries counts with function `1000 * Math.pow(2, retry) + Math.ra
270268

271269
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).
272270

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:
274272
- `ETIMEDOUT`: One of the [timeout](#timeout) limits were reached.
275273
- `ECONNRESET`: Connection was forcibly closed by a peer.
276274
- `EADDRINUSE`: Could not bind to any free port.
@@ -362,7 +360,7 @@ Called with [normalized](source/normalize-arguments.js) [request options](#optio
362360

363361
See the [AWS section](#aws) for an example.
364362

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.
366364

367365
###### hooks.beforeRedirect
368366

@@ -502,7 +500,7 @@ The object contains the following properties:
502500
- `download` - `timings.end - timings.response`
503501
- `total` - `timings.end - timings.start` or `timings.error - timings.start`
504502

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.
506504

507505
##### fromCache
508506

@@ -524,7 +522,7 @@ The number of times the request was retried.
524522

525523
#### Streams
526524

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.
528526

529527
#### got.stream(url, [options])
530528

@@ -536,7 +534,7 @@ Returns a [duplex stream](https://nodejs.org/api/stream.html#stream_class_stream
536534

537535
`request` event to get the request object of the request.
538536

539-
**Tip**: You can use `request` event to abort request:
537+
**Tip:** You can use `request` event to abort request:
540538

541539
```js
542540
got.stream('github.com')
@@ -639,7 +637,7 @@ client.get('/demo');
639637
})();
640638
```
641639

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).
643641

644642
#### got.mergeOptions(parentOptions, newOptions)
645643

@@ -1015,7 +1013,7 @@ const custom = got.extend({
10151013
})();
10161014
```
10171015

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).
10191017

10201018
### Experimental HTTP2 support
10211019

@@ -1037,8 +1035,8 @@ const h2got = got.extend({request});
10371035

10381036
| | `got` | `request` | `node-fetch` | `axios` |
10391037
|-----------------------|:------------:|:------------:|:------------:|:------------:|
1040-
| HTTP/2 support |||||
1041-
| Browser support |||* ||
1038+
| HTTP/2 support | ||||
1039+
| Browser support |||\* ||
10421040
| Electron support |||||
10431041
| Promise API |||||
10441042
| Stream API ||| Node.js only ||

0 commit comments

Comments
 (0)
Please sign in to comment.