Files
vscode/extensions/github-authentication/src/node/fetch.ts
Tyler James Leonhardt 631a4d9dbb Workaround electron proxy issues for GitHub by allowing to switch to node's fetch (#261099)
A user reported that their proxy ZScaller has issues with Electron's fetch. More research needs to be done to understand why this is not playing nice wholistically...

... but, to unblock GitHub scenarios like Copilot, we add this setting to change the implementation of fetch used.

At some point, we need to have http.useElectronFetch setting be enabled by default and when that happens, this setting can be removed in favor of that.

cc @chrmarti @alexdima
2025-08-11 18:39:45 +00:00

22 lines
700 B
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { workspace } from 'vscode';
let _fetch: typeof fetch;
const useElectronFetch = workspace.getConfiguration('github-authentication').get<boolean>('useElectronFetch', true);
if (useElectronFetch) {
try {
_fetch = require('electron').net.fetch;
} catch {
_fetch = fetch;
}
} else {
_fetch = fetch;
}
export const fetching = _fetch;