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

Feature Request: Allow getProxyForUrl to be asynchronous #264

Closed
mook-as opened this issue Dec 1, 2023 · 1 comment · Fixed by #275
Closed

Feature Request: Allow getProxyForUrl to be asynchronous #264

mook-as opened this issue Dec 1, 2023 · 1 comment · Fixed by #275

Comments

@mook-as
Copy link
Contributor

mook-as commented Dec 1, 2023

(This request is for proxy-agent)

Currently, GetProxyForUrlCallback returns a string synchronously:

type GetProxyForUrlCallback = (url: string) => string;

However, it may be necessary to resolve it asynchronously; for example Electron.Session.resolveProxy(url) returns a Promise<string>.

Since that is only used in async connect(), making that asynchronous shouldn't be too onerous; for backwards compatibility, it should be possible to:

  • Make it type GetProxyForUrlCallback = (url: string) => string | Promise<string>;
  • Change the single call site to const proxy = await Promise.resolve(this.getProxyForUrl(url));

Please let me know if that seems reasonable and I can attempt to whip up a PR. (If you think that it would be easier to implement the feature directly, that's excellent too.)

Thanks!

@TooTallNate
Copy link
Owner

Sounds reasonable. I'd accept a PR.

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

Successfully merging a pull request may close this issue.

2 participants