proxy-util: Fix misuse of void.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-07-01 14:54:36 -07:00
parent 9ceabe02d5
commit 24b28f9ded
2 changed files with 6 additions and 4 deletions

View File

@@ -6,12 +6,12 @@ export interface ProxyRule {
}
// Return proxy to be used for a particular uri, to be used for request
export function getProxy(_uri: string): ProxyRule | void {
export function getProxy(_uri: string): ProxyRule | undefined {
let uri;
try {
uri = new URL(_uri);
} catch {
return;
return undefined;
}
const proxyRules = ConfigUtil.getConfigItem('proxyRules', '').split(';');
@@ -19,7 +19,7 @@ export function getProxy(_uri: string): ProxyRule | void {
// environment. NO_PROXY = '*' makes request ignore all environment proxy variables.
if (proxyRules[0] === '') {
process.env.NO_PROXY = '*';
return;
return undefined;
}
const proxyRule: any = {};
@@ -42,6 +42,8 @@ export function getProxy(_uri: string): ProxyRule | void {
});
return proxyRule;
}
return undefined;
}
// TODO: Refactor to async function

View File

@@ -17,7 +17,7 @@ const logger = new Logger({
interface RequestUtilResponse {
ca: string;
proxy: string | void | ProxyUtil.ProxyRule;
proxy: string | undefined | ProxyUtil.ProxyRule;
ecdhCurve: 'auto';
headers: { 'User-Agent': string };
}