Skip to content

Commit

Permalink
feat: enable advanced retry options (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
nijitaro authored Jan 30, 2020
1 parent 9f4a648 commit bdae0c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ function httpModule (_moduleOptions) {
options.retry = 2
} else if (!options.retry) {
options.retry = 0
} else if (!isNaN(options.retry)) {
options.retry = parseInt(options.retry)
} else if (typeof options.retry === 'object') {
options.retry = JSON.stringify(options.retry)
}

// Convert http:// to https:// if https option is on
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default (ctx, inject) => {

// Defaults
const defaults = {
retry: <%= parseInt(options.retry) %>,
retry: <%= options.retry %>,
timeout: process.server ? <%= options.serverTimeout %> : <%= options.clientTimeout %>,
prefixUrl,
headers: {}
Expand Down

0 comments on commit bdae0c0

Please sign in to comment.