mirror of https://github.com/sundowndev/http.git
global retry
parent
ab7299aef7
commit
a94424543d
|
@ -81,13 +81,13 @@ proxy: {
|
|||
|
||||
* Default: `false`
|
||||
|
||||
Automatically intercept failed requests and retries them whenever posible using [http-retry](https://github.com/softonic/http-retry).
|
||||
Automatically intercept failed requests and retry before failing.
|
||||
|
||||
By default, number of retries will be **3 times**, if `retry` value is set to `true`. You can change it by passing an object like this:
|
||||
By default, number of retries will be **2 times**, if `retry` value is set to `true`. You can change it by passing an object like this:
|
||||
|
||||
```js
|
||||
http: {
|
||||
retry: { retries: 3 }
|
||||
retry: 1
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -62,7 +62,9 @@ function httpModule(_moduleOptions) {
|
|||
|
||||
// Normalize options
|
||||
if (options.retry === true) {
|
||||
options.retry = {}
|
||||
options.retry = 2
|
||||
} else if (!options.retry) {
|
||||
options.retry = 0
|
||||
}
|
||||
|
||||
// Convert http:// to https:// if https option is on
|
||||
|
|
|
@ -77,7 +77,10 @@ export default (ctx, inject) => {
|
|||
: (process.env._HTTP_BASE_URL_ || '<%= options.baseURL %>')
|
||||
|
||||
// Defaults
|
||||
const defaults = { prefixUrl }
|
||||
const defaults = {
|
||||
retry: <%= parseInt(options.retry) %>,
|
||||
prefixUrl
|
||||
}
|
||||
|
||||
<% if (options.proxyHeaders) { %>
|
||||
// Proxy SSR request headers headers
|
||||
|
|
Loading…
Reference in New Issue