@@ -8,12 +8,12 @@ and [http2.request](https://nodejs.org/api/http2.html#http2_clienthttp2session_r
8
8
9
9
* Fetch-alike
10
10
* Cool-beans config options (with defaults)
11
- * Automatic HTTP2 support (ALPN negotiation)
11
+ * Automatic HTTP/2 support (ALPN negotiation)
12
12
* Automatic or opt-in body parse (with non-UTF-8 charset decoding)
13
13
* Automatic and simplistic ` Cookies ` treatment (with built-in jar)
14
14
* Automatic decompression (with opt-in body compression)
15
15
* Built-in streamable ` File ` & ` FormData ` interfaces
16
- * Support redirects with fine-grained tune-ups
16
+ * Support redirects & retries with fine-grained tune-ups
17
17
* Support all legit request body types (include blobs & streams)
18
18
* Support both CJS and ESM module systems
19
19
* Fully promise-able and pipe-able
@@ -120,54 +120,63 @@ console.log(res.body);
120
120
extra [ http2.ClientSessionOptions] ( https://nodejs.org/api/http2.html#http2_http2_connect_authority_options_listener )
121
121
& [ http2.ClientSessionRequestOptions] ( https://nodejs.org/api/http2.html#http2_clienthttp2session_request_headers_options )
122
122
and [ tls.ConnectionOptions] ( https://nodejs.org/api/tls.html#tls_tls_connect_options_callback )
123
- for the HTTP2 attunes
123
+ for HTTP/2 attunes
124
124
* ` body ` ** {string | Array | AsyncIterator | Blob | Buffer | File | FromData | Iterator | Object | Readable |
125
- Uint8Array | URLSearchParams}** Body to send with the request
126
- * ` cookies ` ** {boolean | Array[[ key, value ]] | Cookies | Object | URLSearchParams}** ` Default: true ` Cookies to add to
125
+ Uint8Array | URLSearchParams}** The body to send with the request
126
+ * ` cookies ` ** {boolean | Array< [ k, v ] > | Cookies | Object | URLSearchParams}** ` Default: true ` The cookies to add to
127
127
the request
128
- * ` digest ` ** {boolean}** ` Default: true ` Read response stream, or simply add a mixin
129
- * ` follow ` ** {number}** ` Default: 20 ` Number of redirects to follow
130
- * ` h2 ` ** {boolean}** ` Default: false ` Forces use of the HTTP2 protocol
131
- * ` headers ` ** {Object}** Headers to add to the request
132
- * ` parse ` ** {boolean}** ` Default: true ` Parse response body, or simply return a buffer
133
- * ` redirect ` ** {error | follow | manual}** ` Default: 'follow' ` Controls redirect flow
134
- * ` thenable ` ** {boolean}** ` Default: false ` Controls promise resolutions
128
+ * ` digest ` ** {boolean}** ` Default: true ` Controls whether to read the response stream or just add a mixin
129
+ * ` follow ` ** {number}** ` Default: 20 ` The number of redirects to follow
130
+ * ` h2 ` ** {boolean}** ` Default: false ` Forces the use of HTTP/2 protocol
131
+ * ` headers ` ** {Object}** The headers to add to the request
132
+ * ` maxRetryAfter ` ** {number}** The upper limit of ` retry-after ` header. If unset, it will use ` timeout ` value
133
+ * ` parse ` ** {boolean}** ` Default: true ` Controls whether to parse response body or simply return a buffer
134
+ * ` redirect ` ** {error | follow | manual}** ` Default: follow ` Controls the redirect flows
135
+ * ` retry ` ** {Object}** Represents the retry options
136
+ * ` attempts ` ** {number}** ` Default: 0 ` The number of retry attempts
137
+ * ` backoffStrategy ` ** {string}** ` Default: interval * Math.log(Math.random() * (Math.E * Math.E - Math.E) + Math.E) `
138
+ The backoff strategy algorithm that increases logarithmically. To fixate set value to ` interval * 1 `
139
+ * ` interval ` ** {number}** ` Default: 1e3 ` The initial retry interval
140
+ * ` retryAfter ` ** {boolean}** ` Default: true ` Controls ` retry-after ` header receptiveness
141
+ * ` statusCodes ` ** {number[ ] }** ` Default: [429, 503] ` The list of status codes to retry on
142
+ * ` thenable ` ** {boolean}** ` Default: false ` Controls the promise resolutions
143
+ * ` timeout ` ** {number}** ` Default: 3e5 ` The number of milliseconds a request can take before termination
135
144
* ** Returns:** Promise that resolves to
136
145
extended [ http.IncomingMessage] ( https://nodejs.org/api/http.html#http_class_http_incomingmessage )
137
146
or [ http2.ClientHttp2Stream] ( https://nodejs.org/api/http2.html#http2_class_clienthttp2stream ) which is respectively
138
147
readable and duplex streams
139
148
* if ` degist: true ` & ` parse: true `
140
- * ` body ` ** {string | Array | Buffer | Object}** Body based on its content type
149
+ * ` body ` ** {string | Array | Buffer | Object}** The body based on its content type
141
150
* if ` degist: false `
142
151
* ` arrayBuffer ` ** {AsyncFunction}** Reads the response and returns ** ArrayBuffer**
143
152
* ` blob ` ** {AsyncFunction}** Reads the response and returns ** Blob**
144
153
* ` body ` ** {AsyncFunction}** Reads the response and returns ** Buffer** if ` parse: false `
145
154
* ` json ` ** {AsyncFunction}** Reads the response and returns ** Object**
146
155
* ` text ` ** {AsyncFunction}** Reads the response and returns ** String**
147
- * ` bodyUsed ` ** {boolean}** Whether the response were read or not
148
- * ` cookies ` ** {undefined | Cookies}** Cookies sent and received with the response
149
- * ` headers ` ** {Object}** Headers received with the response
156
+ * ` bodyUsed ` ** {boolean}** Indicates whether the response were read or not
157
+ * ` cookies ` ** {undefined | Cookies}** The cookies sent and received with the response
158
+ * ` headers ` ** {Object}** The headers received with the response
150
159
* ` httpVersion ` ** {string}** Indicates protocol version negotiated with the server
151
160
* ` ok ` ** {boolean}** Indicates if the response was successful (statusCode: ** 200-299** )
152
161
* ` redirected ` ** {boolean}** Indicates if the response is the result of a redirect
153
162
* ` statusCode ` ** {number}** Indicates the status code of the response
154
- * ` trailers ` ** {undefined | Object}** Trailer headers received with the response
163
+ * ` trailers ` ** {undefined | Object}** The trailer headers received with the response
155
164
156
165
---
157
166
158
167
#### ` rekwest.defaults `
159
168
160
- Object to fill with default [ options] ( #rekwesturl-options )
169
+ The object to fulfill with default [ options] ( #rekwesturl-options )
161
170
162
171
---
163
172
164
173
#### ` rekwest.stream(url[, options]) `
165
174
166
- Method with limited functionality to use with streams and pipes
175
+ The method with limited functionality to use with streams and/or pipes
167
176
168
177
* No automata
169
178
* No redirects
170
- * Pass ` h2: true ` in options to use the HTTP2 protocol
179
+ * Pass ` h2: true ` in options to use HTTP/2 protocol
171
180
* Or use ` ackn({ url: URL }) ` method in advance to probe the available protocols
172
181
173
182
---
0 commit comments