MCPcopy
hub / github.com/microsoft/vscode-js-debug / NetworkRequest

Class NetworkRequest

src/ui/networkTree.ts:343–522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343export class NetworkRequest {
344 public readonly ctime = Date.now();
345 public mtime = Date.now();
346 public response?: Cdp.Network.Response;
347 public responseExtra?: Cdp.Network.ResponseReceivedExtraInfoEvent;
348 public failed?: Cdp.Network.LoadingFailedEvent;
349 public finished?: Cdp.Network.LoadingFinishedEvent;
350
351 public get isComplete() {
352 return !!(this.finished || this.failed);
353 }
354
355 public get id() {
356 return this.init.requestId;
357 }
358
359 public get fsUri() {
360 return vscode.Uri.from({
361 scheme: networkFilesystemScheme,
362 path: `/${this.session.id}/${this.id}`,
363 });
364 }
365
366 public get fsBodyUri() {
367 return vscode.Uri.from({
368 scheme: networkFilesystemScheme,
369 path: `/${this.session.id}/${this.id}/body`,
370 });
371 }
372
373 constructor(
374 public readonly init: Cdp.Network.RequestWillBeSentEvent,
375 public readonly session: vscode.DebugSession,
376 ) {}
377
378 /** Returns a tree-item representation of the request. */
379 public toTreeItem() {
380 let icon: vscode.ThemeIcon;
381 if (!this.isComplete) {
382 icon = new vscode.ThemeIcon(
383 'sync~spin',
384 new vscode.ThemeColor('notebookStatusRunningIcon.foreground'),
385 );
386 } else if (this.failed) {
387 icon = new vscode.ThemeIcon(
388 'error',
389 new vscode.ThemeColor('notebookStatusErrorIcon.foreground'),
390 );
391 } else if (this.response && this.response.status >= 400) {
392 icon = new vscode.ThemeIcon('warning');
393 } else {
394 icon = new vscode.ThemeIcon(
395 'check',
396 new vscode.ThemeColor('notebookStatusSuccessIcon.foreground'),
397 );
398 }
399
400 let label = '';

Callers

nothing calls this directly

Calls 2

onceFunction · 0.90
customRequestMethod · 0.80

Tested by

no test coverage detected