Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove HTTP Client usage #20922

Merged
merged 2 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions build/webpack/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ exports.nodeModulesToExternalize = [
'unicode/category/Mc',
'unicode/category/Nd',
'unicode/category/Pc',
'request',
'request-progress',
'source-map-support',
'diff-match-patch',
'sudo-prompt',
Expand Down
697 changes: 108 additions & 589 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1843,8 +1843,6 @@
"named-js-regexp": "^1.3.3",
"node-stream-zip": "^1.6.0",
"reflect-metadata": "^0.1.12",
"request": "^2.87.0",
"request-progress": "^3.0.0",
"rxjs": "^6.5.4",
"rxjs-compat": "^6.5.4",
"semver": "^5.5.0",
Expand All @@ -1867,6 +1865,7 @@
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@types/bent": "^7.3.0",
"@types/chai": "^4.1.2",
"@types/chai-arrays": "^2.0.0",
"@types/chai-as-promised": "^7.1.0",
Expand All @@ -1879,7 +1878,6 @@
"@types/mocha": "^9.1.0",
"@types/nock": "^10.0.3",
"@types/node": "^14.18.0",
"@types/request": "^2.47.0",
"@types/semver": "^5.5.0",
"@types/shortid": "^0.0.29",
"@types/sinon": "^10.0.11",
Expand All @@ -1893,6 +1891,7 @@
"@typescript-eslint/eslint-plugin": "^3.7.0",
"@typescript-eslint/parser": "^3.7.0",
"@vscode/test-electron": "^2.1.3",
"bent": "^7.3.12",
"chai": "^4.1.2",
"chai-arrays": "^2.0.0",
"chai-as-promised": "^7.1.1",
Expand Down
106 changes: 0 additions & 106 deletions src/client/common/net/fileDownloader.ts

This file was deleted.

74 changes: 0 additions & 74 deletions src/client/common/net/httpClient.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/client/common/serviceRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
IEditorUtils,
IExperimentService,
IExtensions,
IFileDownloader,
IHttpClient,
IInstaller,
IInterpreterPathService,
IPathUtils,
Expand Down Expand Up @@ -58,8 +56,6 @@ import { ExperimentService } from './experiments/service';
import { ProductInstaller } from './installer/productInstaller';
import { InterpreterPathService } from './interpreterPathService';
import { BrowserService } from './net/browser';
import { FileDownloader } from './net/fileDownloader';
import { HttpClient } from './net/httpClient';
import { PersistentStateFactory } from './persistentState';
import { IS_WINDOWS } from './platform/constants';
import { PathUtils } from './platform/pathUtils';
Expand Down Expand Up @@ -128,8 +124,6 @@ export function registerTypes(serviceManager: IServiceManager): void {
serviceManager.addSingleton<IApplicationEnvironment>(IApplicationEnvironment, ApplicationEnvironment);
serviceManager.addSingleton<ILanguageService>(ILanguageService, LanguageService);
serviceManager.addSingleton<IBrowserService>(IBrowserService, BrowserService);
serviceManager.addSingleton<IHttpClient>(IHttpClient, HttpClient);
serviceManager.addSingleton<IFileDownloader>(IFileDownloader, FileDownloader);
serviceManager.addSingleton<IEditorUtils>(IEditorUtils, EditorUtils);
serviceManager.addSingleton<ITerminalActivator>(ITerminalActivator, TerminalActivator);
serviceManager.addSingleton<ITerminalActivationHandler>(
Expand Down
36 changes: 0 additions & 36 deletions src/client/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
'use strict';

import { Socket } from 'net';
import { Request as RequestResult } from 'request';
import {
CancellationToken,
ConfigurationChangeEvent,
Expand Down Expand Up @@ -360,41 +359,6 @@ export type DownloadOptions = {
extension: 'tmp' | string;
};

export const IFileDownloader = Symbol('IFileDownloader');
/**
* File downloader, that'll display progress in the status bar.
*
* @export
* @interface IFileDownloader
*/
export interface IFileDownloader {
/**
* Download file and display progress in statusbar.
* Optionnally display progress in the provided output channel.
*
* @param {string} uri
* @param {DownloadOptions} options
* @returns {Promise<string>}
* @memberof IFileDownloader
*/
downloadFile(uri: string, options: DownloadOptions): Promise<string>;
}

export const IHttpClient = Symbol('IHttpClient');
export interface IHttpClient {
downloadFile(uri: string): Promise<RequestResult>;
/**
* Downloads file from uri as string and parses them into JSON objects
* @param uri The uri to download the JSON from
* @param strict Set `false` to allow trailing comma and comments in the JSON, defaults to `true`
*/
getJSON<T>(uri: string, strict?: boolean): Promise<T>;
/**
* Returns the url is valid (i.e. return status code of 200).
*/
exists(uri: string): Promise<boolean>;
}

export const IExtensionContext = Symbol('ExtensionContext');
export interface IExtensionContext extends ExtensionContext {}

Expand Down
6 changes: 0 additions & 6 deletions src/test/common/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ import {
} from '../../client/common/installer/types';
import { InterpreterPathService } from '../../client/common/interpreterPathService';
import { BrowserService } from '../../client/common/net/browser';
import { FileDownloader } from '../../client/common/net/fileDownloader';
import { HttpClient } from '../../client/common/net/httpClient';
import { PersistentStateFactory } from '../../client/common/persistentState';
import { PathUtils } from '../../client/common/platform/pathUtils';
import { CurrentProcess } from '../../client/common/process/currentProcess';
Expand Down Expand Up @@ -78,8 +76,6 @@ import {
IEditorUtils,
IExperimentService,
IExtensions,
IFileDownloader,
IHttpClient,
IInstaller,
IInterpreterPathService,
IPathUtils,
Expand Down Expand Up @@ -199,8 +195,6 @@ suite('Installer', () => {
ioc.serviceManager.addSingleton<IDebugService>(IDebugService, DebugService);
ioc.serviceManager.addSingleton<IApplicationEnvironment>(IApplicationEnvironment, ApplicationEnvironment);
ioc.serviceManager.addSingleton<IBrowserService>(IBrowserService, BrowserService);
ioc.serviceManager.addSingleton<IHttpClient>(IHttpClient, HttpClient);
ioc.serviceManager.addSingleton<IFileDownloader>(IFileDownloader, FileDownloader);
ioc.serviceManager.addSingleton<IEditorUtils>(IEditorUtils, EditorUtils);
ioc.serviceManager.addSingleton<ITerminalActivator>(ITerminalActivator, TerminalActivator);
ioc.serviceManager.addSingleton<ITerminalActivationHandler>(
Expand Down
6 changes: 0 additions & 6 deletions src/test/common/moduleInstaller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import { ProductInstaller } from '../../client/common/installer/productInstaller
import { IModuleInstaller } from '../../client/common/installer/types';
import { InterpreterPathService } from '../../client/common/interpreterPathService';
import { BrowserService } from '../../client/common/net/browser';
import { FileDownloader } from '../../client/common/net/fileDownloader';
import { HttpClient } from '../../client/common/net/httpClient';
import { PersistentStateFactory } from '../../client/common/persistentState';
import { FileSystem } from '../../client/common/platform/fileSystem';
import { PathUtils } from '../../client/common/platform/pathUtils';
Expand Down Expand Up @@ -77,8 +75,6 @@ import {
IEditorUtils,
IExperimentService,
IExtensions,
IFileDownloader,
IHttpClient,
IInstaller,
IInterpreterPathService,
IPathUtils,
Expand Down Expand Up @@ -211,8 +207,6 @@ suite('Module Installer', () => {
JupyterExtensionDependencyManager,
);
ioc.serviceManager.addSingleton<IBrowserService>(IBrowserService, BrowserService);
ioc.serviceManager.addSingleton<IHttpClient>(IHttpClient, HttpClient);
ioc.serviceManager.addSingleton<IFileDownloader>(IFileDownloader, FileDownloader);
ioc.serviceManager.addSingleton<IEditorUtils>(IEditorUtils, EditorUtils);
ioc.serviceManager.addSingleton<ITerminalActivator>(ITerminalActivator, TerminalActivator);
ioc.serviceManager.addSingleton<ITerminalActivationHandler>(
Expand Down
Loading