Skip to content

Commit 5a69349

Browse files
committed
Remove HTTP Client usage
1 parent 807b9fe commit 5a69349

12 files changed

+114
-1247
lines changed

package-lock.json

Lines changed: 108 additions & 589 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,8 +1843,6 @@
18431843
"named-js-regexp": "^1.3.3",
18441844
"node-stream-zip": "^1.6.0",
18451845
"reflect-metadata": "^0.1.12",
1846-
"request": "^2.87.0",
1847-
"request-progress": "^3.0.0",
18481846
"rxjs": "^6.5.4",
18491847
"rxjs-compat": "^6.5.4",
18501848
"semver": "^5.5.0",
@@ -1867,6 +1865,7 @@
18671865
},
18681866
"devDependencies": {
18691867
"@istanbuljs/nyc-config-typescript": "^1.0.2",
1868+
"@types/bent": "^7.3.0",
18701869
"@types/chai": "^4.1.2",
18711870
"@types/chai-arrays": "^2.0.0",
18721871
"@types/chai-as-promised": "^7.1.0",
@@ -1879,7 +1878,6 @@
18791878
"@types/mocha": "^9.1.0",
18801879
"@types/nock": "^10.0.3",
18811880
"@types/node": "^14.18.0",
1882-
"@types/request": "^2.47.0",
18831881
"@types/semver": "^5.5.0",
18841882
"@types/shortid": "^0.0.29",
18851883
"@types/sinon": "^10.0.11",
@@ -1893,6 +1891,7 @@
18931891
"@typescript-eslint/eslint-plugin": "^3.7.0",
18941892
"@typescript-eslint/parser": "^3.7.0",
18951893
"@vscode/test-electron": "^2.1.3",
1894+
"bent": "^7.3.12",
18961895
"chai": "^4.1.2",
18971896
"chai-arrays": "^2.0.0",
18981897
"chai-as-promised": "^7.1.1",

src/client/common/net/fileDownloader.ts

Lines changed: 0 additions & 106 deletions
This file was deleted.

src/client/common/net/httpClient.ts

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/client/common/serviceRegistry.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import {
88
IEditorUtils,
99
IExperimentService,
1010
IExtensions,
11-
IFileDownloader,
12-
IHttpClient,
1311
IInstaller,
1412
IInterpreterPathService,
1513
IPathUtils,
@@ -58,8 +56,6 @@ import { ExperimentService } from './experiments/service';
5856
import { ProductInstaller } from './installer/productInstaller';
5957
import { InterpreterPathService } from './interpreterPathService';
6058
import { BrowserService } from './net/browser';
61-
import { FileDownloader } from './net/fileDownloader';
62-
import { HttpClient } from './net/httpClient';
6359
import { PersistentStateFactory } from './persistentState';
6460
import { IS_WINDOWS } from './platform/constants';
6561
import { PathUtils } from './platform/pathUtils';
@@ -128,8 +124,6 @@ export function registerTypes(serviceManager: IServiceManager): void {
128124
serviceManager.addSingleton<IApplicationEnvironment>(IApplicationEnvironment, ApplicationEnvironment);
129125
serviceManager.addSingleton<ILanguageService>(ILanguageService, LanguageService);
130126
serviceManager.addSingleton<IBrowserService>(IBrowserService, BrowserService);
131-
serviceManager.addSingleton<IHttpClient>(IHttpClient, HttpClient);
132-
serviceManager.addSingleton<IFileDownloader>(IFileDownloader, FileDownloader);
133127
serviceManager.addSingleton<IEditorUtils>(IEditorUtils, EditorUtils);
134128
serviceManager.addSingleton<ITerminalActivator>(ITerminalActivator, TerminalActivator);
135129
serviceManager.addSingleton<ITerminalActivationHandler>(

src/client/common/types.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
'use strict';
55

66
import { Socket } from 'net';
7-
import { Request as RequestResult } from 'request';
87
import {
98
CancellationToken,
109
ConfigurationChangeEvent,
@@ -360,41 +359,6 @@ export type DownloadOptions = {
360359
extension: 'tmp' | string;
361360
};
362361

363-
export const IFileDownloader = Symbol('IFileDownloader');
364-
/**
365-
* File downloader, that'll display progress in the status bar.
366-
*
367-
* @export
368-
* @interface IFileDownloader
369-
*/
370-
export interface IFileDownloader {
371-
/**
372-
* Download file and display progress in statusbar.
373-
* Optionnally display progress in the provided output channel.
374-
*
375-
* @param {string} uri
376-
* @param {DownloadOptions} options
377-
* @returns {Promise<string>}
378-
* @memberof IFileDownloader
379-
*/
380-
downloadFile(uri: string, options: DownloadOptions): Promise<string>;
381-
}
382-
383-
export const IHttpClient = Symbol('IHttpClient');
384-
export interface IHttpClient {
385-
downloadFile(uri: string): Promise<RequestResult>;
386-
/**
387-
* Downloads file from uri as string and parses them into JSON objects
388-
* @param uri The uri to download the JSON from
389-
* @param strict Set `false` to allow trailing comma and comments in the JSON, defaults to `true`
390-
*/
391-
getJSON<T>(uri: string, strict?: boolean): Promise<T>;
392-
/**
393-
* Returns the url is valid (i.e. return status code of 200).
394-
*/
395-
exists(uri: string): Promise<boolean>;
396-
}
397-
398362
export const IExtensionContext = Symbol('ExtensionContext');
399363
export interface IExtensionContext extends ExtensionContext {}
400364

src/test/common/installer.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ import {
4242
} from '../../client/common/installer/types';
4343
import { InterpreterPathService } from '../../client/common/interpreterPathService';
4444
import { BrowserService } from '../../client/common/net/browser';
45-
import { FileDownloader } from '../../client/common/net/fileDownloader';
46-
import { HttpClient } from '../../client/common/net/httpClient';
4745
import { PersistentStateFactory } from '../../client/common/persistentState';
4846
import { PathUtils } from '../../client/common/platform/pathUtils';
4947
import { CurrentProcess } from '../../client/common/process/currentProcess';
@@ -78,8 +76,6 @@ import {
7876
IEditorUtils,
7977
IExperimentService,
8078
IExtensions,
81-
IFileDownloader,
82-
IHttpClient,
8379
IInstaller,
8480
IInterpreterPathService,
8581
IPathUtils,
@@ -199,8 +195,6 @@ suite('Installer', () => {
199195
ioc.serviceManager.addSingleton<IDebugService>(IDebugService, DebugService);
200196
ioc.serviceManager.addSingleton<IApplicationEnvironment>(IApplicationEnvironment, ApplicationEnvironment);
201197
ioc.serviceManager.addSingleton<IBrowserService>(IBrowserService, BrowserService);
202-
ioc.serviceManager.addSingleton<IHttpClient>(IHttpClient, HttpClient);
203-
ioc.serviceManager.addSingleton<IFileDownloader>(IFileDownloader, FileDownloader);
204198
ioc.serviceManager.addSingleton<IEditorUtils>(IEditorUtils, EditorUtils);
205199
ioc.serviceManager.addSingleton<ITerminalActivator>(ITerminalActivator, TerminalActivator);
206200
ioc.serviceManager.addSingleton<ITerminalActivationHandler>(

src/test/common/moduleInstaller.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ import { ProductInstaller } from '../../client/common/installer/productInstaller
3838
import { IModuleInstaller } from '../../client/common/installer/types';
3939
import { InterpreterPathService } from '../../client/common/interpreterPathService';
4040
import { BrowserService } from '../../client/common/net/browser';
41-
import { FileDownloader } from '../../client/common/net/fileDownloader';
42-
import { HttpClient } from '../../client/common/net/httpClient';
4341
import { PersistentStateFactory } from '../../client/common/persistentState';
4442
import { FileSystem } from '../../client/common/platform/fileSystem';
4543
import { PathUtils } from '../../client/common/platform/pathUtils';
@@ -77,8 +75,6 @@ import {
7775
IEditorUtils,
7876
IExperimentService,
7977
IExtensions,
80-
IFileDownloader,
81-
IHttpClient,
8278
IInstaller,
8379
IInterpreterPathService,
8480
IPathUtils,
@@ -211,8 +207,6 @@ suite('Module Installer', () => {
211207
JupyterExtensionDependencyManager,
212208
);
213209
ioc.serviceManager.addSingleton<IBrowserService>(IBrowserService, BrowserService);
214-
ioc.serviceManager.addSingleton<IHttpClient>(IHttpClient, HttpClient);
215-
ioc.serviceManager.addSingleton<IFileDownloader>(IFileDownloader, FileDownloader);
216210
ioc.serviceManager.addSingleton<IEditorUtils>(IEditorUtils, EditorUtils);
217211
ioc.serviceManager.addSingleton<ITerminalActivator>(ITerminalActivator, TerminalActivator);
218212
ioc.serviceManager.addSingleton<ITerminalActivationHandler>(

0 commit comments

Comments
 (0)