mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 09:08:53 +01:00
avoid async and winjs.promise, #53442
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
import { Url, parse as parseUrl } from 'url';
|
||||
import { isBoolean } from 'vs/base/common/types';
|
||||
import { Agent } from './request';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
|
||||
function getSystemProxyURI(requestURL: Url): string {
|
||||
if (requestURL.protocol === 'http:') {
|
||||
@@ -26,7 +24,7 @@ export interface IOptions {
|
||||
strictSSL?: boolean;
|
||||
}
|
||||
|
||||
export async function getProxyAgent(rawRequestURL: string, options: IOptions = {}): TPromise<Agent> {
|
||||
export async function getProxyAgent(rawRequestURL: string, options: IOptions = {}): Promise<Agent> {
|
||||
const requestURL = parseUrl(rawRequestURL);
|
||||
const proxyURL = options.proxyUrl || getSystemProxyURI(requestURL);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ export interface IRequestFunction {
|
||||
(options: IRequestOptions): TPromise<IRequestContext>;
|
||||
}
|
||||
|
||||
async function getNodeRequest(options: IRequestOptions): TPromise<IRawRequestFunction> {
|
||||
async function getNodeRequest(options: IRequestOptions): Promise<IRawRequestFunction> {
|
||||
const endpoint = parseUrl(options.url);
|
||||
const module = endpoint.protocol === 'https:' ? await import('https') : await import('http');
|
||||
return module.request;
|
||||
@@ -60,7 +60,7 @@ export function request(options: IRequestOptions): TPromise<IRequestContext> {
|
||||
|
||||
const rawRequestPromise = options.getRawRequest
|
||||
? TPromise.as(options.getRawRequest(options))
|
||||
: getNodeRequest(options);
|
||||
: TPromise.wrap(getNodeRequest(options));
|
||||
|
||||
return rawRequestPromise.then(rawRequest => {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user