diff --git a/lib/rest.js b/lib/rest.js index 8b19c69..a5eb654 100644 --- a/lib/rest.js +++ b/lib/rest.js @@ -67,7 +67,8 @@ class RestClient { // Only apply proxy agents if custom agents are not explicitly provided // Priority: explicit httpsAgent/httpAgent > proxy config > default const hasCustomAgents = - 'httpsAgent' in this.restClientConfig || 'httpAgent' in this.restClientConfig; + this.restClientConfig && + ('httpsAgent' in this.restClientConfig || 'httpAgent' in this.restClientConfig); const proxyAgents = hasCustomAgents ? {} : getProxyAgentForUrl(url, this.restClientConfig); return this.axiosInstance