diff --git a/lib/module.js b/lib/module.js index 5f5fb3d..cd2841a 100755 --- a/lib/module.js +++ b/lib/module.js @@ -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 diff --git a/lib/plugin.js b/lib/plugin.js index 331412b..3b61f37 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -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: {}