Commit ea22f86a authored by liuwei's avatar liuwei

正则 优化

parent 3948b207
...@@ -78,11 +78,11 @@ module.exports = function (options) { ...@@ -78,11 +78,11 @@ module.exports = function (options) {
debug(option) debug(option)
if (!option.agent && !/^https/.test(option.uri)) { // if (!option.agent && !/^https/.test(option.uri)) {
option.agent = httpAgent option.agent = (option && option.uri && option.uri.indexOf('https') != -1) ? httpsAgent : httpAgent
} else if (!option.agent && /^https/.test(option.uri)) { // } else if (!option.agent && /^https/.test(option.uri)) {
option.agent = httpsAgent // option.agent = httpsAgent
} // }
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
request(option, function (err, response, body) { request(option, function (err, response, body) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment