@bugspotter/sdk
Version:
Professional bug reporting SDK with screenshots, session replay, and automatic error capture for web applications
33 lines (32 loc) • 985 B
TypeScript
import { BaseCapture, type CaptureOptions } from './base-capture';
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
export interface NetworkCaptureOptions extends CaptureOptions {
maxRequests?: number;
filterUrls?: (url: string) => boolean;
}
export declare class NetworkCapture extends BaseCapture<NetworkRequest[], NetworkCaptureOptions> {
private buffer;
private filterUrls?;
private originalFetch;
private originalXHR;
private isIntercepting;
constructor(options?: NetworkCaptureOptions);
capture(): NetworkRequest[];
private parseFetchArgs;
private createNetworkRequest;
private addRequest;
private interceptFetch;
private interceptXHR;
getRequests(): NetworkRequest[];
clear(): void;
destroy(): void;
}
export interface NetworkRequest {
url: string;
method: HttpMethod;
status: number;
duration: number;
timestamp: number;
error?: string;
}
export {};