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
* Add ability to resolve with latest response to the retry middle ([60a7453](https://github.com/elbywan/wretch/commit/60a7453)), closes [#141](https://github.com/elbywan/wretch/issues/141)
8
+
9
+
### :memo: Documentation update(s)
10
+
11
+
* Remove outdated documentation entries for the retry middleware ([7a5620c](https://github.com/elbywan/wretch/commit/7a5620c))
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@
19
19
20
20
<br>
21
21
22
-
##### Wretch 2.0 is now live 🎉 ! Please have a look at the [releases](https://github.com/elbywan/wretch/releases) and the [changelog](https://github.com/elbywan/wretch/blob/master/CHANGELOG.md) after each update for new features and breaking changes. If you want to try out the hot stuff, please look into the [dev](https://github.com/elbywan/wretch/tree/dev) branch.
22
+
##### Wretch 2.1 is now live 🎉 ! Please have a look at the [releases](https://github.com/elbywan/wretch/releases) and the [changelog](https://github.com/elbywan/wretch/blob/master/CHANGELOG.md) after each update for new features and breaking changes. If you want to try out the hot stuff, please look into the [dev](https://github.com/elbywan/wretch/tree/dev) branch.
23
23
24
24
##### And if you like the library please consider becoming a [sponsor](https://github.com/sponsors/elbywan) ❤️.
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/1981837/src/addons/abort.ts#L110">src/addons/abort.ts:110</a></li></ul></aside></li></ul></section></div>
31
+
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/60a7453/src/addons/abort.ts#L110">src/addons/abort.ts:110</a></li></ul></aside></li></ul></section></div>
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/1981837/src/addons/perfs.ts#L114">src/addons/perfs.ts:114</a></li></ul></aside></li></ul></section></div>
35
+
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/60a7453/src/addons/perfs.ts#L114">src/addons/perfs.ts:114</a></li></ul></aside></li></ul></section></div>
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/1981837/src/index.ts#L36">src/index.ts:36</a></li></ul></aside></li></ul></section></div>
42
+
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/60a7453/src/index.ts#L36">src/index.ts:36</a></li></ul></aside></li></ul></section></div>
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/1981837/src/middlewares/dedupe.ts#L33">src/middlewares/dedupe.ts:33</a></li></ul></aside></li></ul></section></div>
57
+
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/60a7453/src/middlewares/dedupe.ts#L33">src/middlewares/dedupe.ts:33</a></li></ul></aside></li></ul></section></div>
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/1981837/src/middlewares/delay.ts#L16">src/middlewares/delay.ts:16</a></li></ul></aside></li></ul></section></div>
44
+
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/60a7453/src/middlewares/delay.ts#L16">src/middlewares/delay.ts:16</a></li></ul></aside></li></ul></section></div>
<p>Callback that will get executed before retrying the request. If this function returns an object having url and/or options properties, they will override existing values in the retried request.</p>
<p>If true, will retry the request if a network error was thrown. Will also provide an 'error' argument to the <code>onRetry</code> and <code>until</code> methods.</p>
80
-
</blockquote>
81
-
<blockquote>
82
-
<p><em>(default: false)</em></p>
83
-
</blockquote>
29
+
<pre><codeclass="language-ts"><spanclass="hl-8">import</span><spanclass="hl-2"></span><spanclass="hl-6">wretch</span><spanclass="hl-2"></span><spanclass="hl-8">from</span><spanclass="hl-2"></span><spanclass="hl-5">'wretch'</span><br/><spanclass="hl-8">import</span><spanclass="hl-2"> { </span><spanclass="hl-6">retry</span><spanclass="hl-2"> } </span><spanclass="hl-8">from</span><spanclass="hl-2"></span><spanclass="hl-5">'wretch/middlewares'</span><br/><br/><spanclass="hl-4">wretch</span><spanclass="hl-2">().</span><spanclass="hl-4">middlewares</span><spanclass="hl-2">([</span><br/><spanclass="hl-2"></span><spanclass="hl-4">retry</span><spanclass="hl-2">({</span><br/><spanclass="hl-2"></span><spanclass="hl-0">// Options - defaults below</span><br/><spanclass="hl-2"></span><spanclass="hl-6">delayTimer:</span><spanclass="hl-2"></span><spanclass="hl-7">500</span><spanclass="hl-2">,</span><br/><spanclass="hl-2"></span><spanclass="hl-4">delayRamp</span><spanclass="hl-6">:</span><spanclass="hl-2"> (</span><spanclass="hl-6">delay</span><spanclass="hl-2">, </span><spanclass="hl-6">nbOfAttempts</span><spanclass="hl-2">) </span><spanclass="hl-1">=></span><spanclass="hl-2"></span><spanclass="hl-6">delay</span><spanclass="hl-2"> * </span><spanclass="hl-6">nbOfAttempts</span><spanclass="hl-2">,</span><br/><spanclass="hl-2"></span><spanclass="hl-6">maxAttempts:</span><spanclass="hl-2"></span><spanclass="hl-7">10</span><spanclass="hl-2">,</span><br/><spanclass="hl-2"></span><spanclass="hl-4">until</span><spanclass="hl-6">:</span><spanclass="hl-2"> (</span><spanclass="hl-6">response</span><spanclass="hl-2">, </span><spanclass="hl-6">error</span><spanclass="hl-2">) </span><spanclass="hl-1">=></span><spanclass="hl-2"></span><spanclass="hl-6">response</span><spanclass="hl-2"> && </span><spanclass="hl-6">response</span><spanclass="hl-2">.</span><spanclass="hl-6">ok</span><spanclass="hl-2">,</span><br/><spanclass="hl-2"></span><spanclass="hl-6">onRetry:</span><spanclass="hl-2"></span><spanclass="hl-1">null</span><spanclass="hl-2">,</span><br/><spanclass="hl-2"></span><spanclass="hl-6">retryOnNetworkError:</span><spanclass="hl-2"></span><spanclass="hl-1">false</span><spanclass="hl-2">,</span><br/><spanclass="hl-2"></span><spanclass="hl-6">resolveWithLatestReponse:</span><spanclass="hl-2"></span><spanclass="hl-1">false</span><br/><spanclass="hl-2"> })</span><br/><spanclass="hl-2">])</span><br/><br/><spanclass="hl-0">// You can also return a Promise, which is useful if you want to inspect the body:</span><br/><spanclass="hl-4">wretch</span><spanclass="hl-2">().</span><spanclass="hl-4">middlewares</span><spanclass="hl-2">([</span><br/><spanclass="hl-2"></span><spanclass="hl-4">retry</span><spanclass="hl-2">({</span><br/><spanclass="hl-2"></span><spanclass="hl-4">until</span><spanclass="hl-6">:</span><spanclass="hl-2"></span><spanclass="hl-6">response</span><spanclass="hl-2"></span><spanclass="hl-1">=></span><br/><spanclass="hl-2"></span><spanclass="hl-6">response</span><spanclass="hl-2">.</span><spanclass="hl-4">clone</span><spanclass="hl-2">().</span><spanclass="hl-4">json</span><spanclass="hl-2">().</span><spanclass="hl-4">then</span><spanclass="hl-2">(</span><spanclass="hl-6">body</span><spanclass="hl-2"></span><spanclass="hl-1">=></span><br/><spanclass="hl-2"></span><spanclass="hl-6">body</span><spanclass="hl-2">.</span><spanclass="hl-6">field</span><spanclass="hl-2"> === </span><spanclass="hl-5">'something'</span><br/><spanclass="hl-2"> )</span><br/><spanclass="hl-2"> })</span><br/><spanclass="hl-2">])</span>
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/1981837/src/middlewares/retry.ts#L66">src/middlewares/retry.ts:66</a></li></ul></aside></li></ul></section></div>
39
+
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/60a7453/src/middlewares/retry.ts#L92">src/middlewares/retry.ts:92</a></li></ul></aside></li></ul></section></div>
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/1981837/src/middlewares/throttlingCache.ts#L56">src/middlewares/throttlingCache.ts:56</a></li></ul></aside></li></ul></section></div>
80
+
<li>Defined in <ahref="https://github.com/elbywan/wretch/blob/60a7453/src/middlewares/throttlingCache.ts#L56">src/middlewares/throttlingCache.ts:56</a></li></ul></aside></li></ul></section></div>
0 commit comments