-
Notifications
You must be signed in to change notification settings - Fork 399
Description
Could the documentation around the https://www.pubnub.com/docs/sdks/javascript/api-reference/misc#basic-usage-7 be improved?
Right now pubnub
is using the proxy-agent
library and instantiates a new ProxyAgent
with what we provide into the setProxy
method. However that's not explicitly mentioned anywhere and also proxy-agent
now by default uses environment variables to decide if it should proxy a request or not. Which caught me by surprise and it made me have to scour through the code and use getProxyForUrl
since I didn't want to use environment variables.
export type ProxyAgentOptions = HttpProxyAgentOptions<''> & HttpsProxyAgentOptions<''> & SocksProxyAgentOptions & PacProxyAgentOptions<''> & {
/**
* Default `http.Agent` instance to use when no proxy is
* configured for a request. Defaults to a new `http.Agent()`
* instance with the proxy agent options passed in.
*/
httpAgent?: http.Agent;
/**
* Default `http.Agent` instance to use when no proxy is
* configured for a request. Defaults to a new `https.Agent()`
* instance with the proxy agent options passed in.
*/
httpsAgent?: http.Agent;
/**
* A callback for dynamic provision of proxy for url.
* Defaults to standard proxy environment variables,
* see https://www.npmjs.com/package/proxy-from-env for details
*/
getProxyForUrl?: GetProxyForUrlCallback;
};
So I definitely think the documentation around this part could be improved so that I can also request in the @types/pubnub
repository to add this method in there since it isn't currently typed at all.