Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation around the setProxy method #363

Open
AndreSilva1993 opened this issue Feb 22, 2024 · 0 comments
Open

Documentation around the setProxy method #363

AndreSilva1993 opened this issue Feb 22, 2024 · 0 comments

Comments

@AndreSilva1993
Copy link

AndreSilva1993 commented Feb 22, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant