global retry

master
pooya parsa 2019-03-24 15:42:58 +04:30
parent ab7299aef7
commit a94424543d
3 changed files with 10 additions and 5 deletions

View File

@ -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
}
```

View File

@ -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

View File

@ -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