Use Electron fetch or Node fetch for github-authentication to support proxies (#238149)
* Attempt to use Electron fetch for github-authentication Also changes fallback from node-fetch to the built-in Node fetch * Remove Content-Length header Electron compatibility It looks like it was set incorrectly to the body contents anyways.pull/238163/head
parent
a821bbf97f
commit
87ed97df8b
|
@ -105,8 +105,6 @@ async function exchangeCodeForToken(
|
|||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Content-Length': body.toString()
|
||||
|
||||
},
|
||||
body: body.toString()
|
||||
});
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import fetch from 'node-fetch';
|
||||
|
||||
export const fetching = fetch;
|
||||
let _fetch: typeof fetch;
|
||||
try {
|
||||
_fetch = require('electron').net.fetch;
|
||||
} catch {
|
||||
_fetch = fetch;
|
||||
}
|
||||
export const fetching = _fetch;
|
||||
|
|
Loading…
Reference in New Issue