src/vs/workbench/api/node/extHostCLIServer.ts/CLIServerBase/onRequest
class CLIServerBase:	private onRequest(req: http.IncomingMessage, res: http.ServerResponse): void {
		const sendResponse = (statusCode: number, returnObj: any) => {
			res.writeHead(statusCode, { 'content-type': 'application/json' });
			res.end(JSON.stringify(returnObj || null), (err?: any) => err && this.logService.error(err));
		};

		const chunks: string[] = [];
		req.setEncoding('utf8');
		req.on('data', (d: string) => chunks.push(d));
		req.on('end', async () => {
			try {
				const data: PipeCommand | any = JSON.parse(chunks.join(''));
				let returnObj;
				switch (data.type) {
					case 'open':
						returnObj = await this.open(data);
						break;
					case 'openExternal':
						returnObj = await this.openExternal(data);
						break;
					case 'status':
						returnObj = await this.getStatus(data);
						break;
					case 'extensionManagement':
						returnObj = await this.manageExtensions(data);
						break;
					default:
						sendResponse(404, `Unknown message type: ${data.type}`);
						break;
				}
				sendResponse(200, returnObj);
			} catch (e) {
				const message = e instanceof Error ? e.message : JSON.stringify(e);
				sendResponse(500, message);
				this.logService.error('Error while processing pipe request', e);
			}
		});
	}