import type { EventProcessor, Hub, Integration } from '@sentry/types'; export declare type HttpStatusCodeRange = [number, number] | number; export declare type HttpRequestTarget = string | RegExp; interface HttpClientOptions { /** * HTTP status codes that should be considered failed. * This array can contain tuples of `[begin, end]` (both inclusive), * single status codes, or a combinations of both * * Example: [[500, 505], 507] * Default: [[500, 599]] */ failedRequestStatusCodes?: HttpStatusCodeRange[]; /** * Targets to track for failed requests. * This array can contain strings or regular expressions. * * Example: ['http://localhost', /api\/.*\/] * Default: [/.*\/] */ failedRequestTargets?: HttpRequestTarget[]; } /** HTTPClient integration creates events for failed client side HTTP requests. */ export declare class HttpClient implements Integration { /** * @inheritDoc */ static id: string; /** * @inheritDoc */ name: string; private readonly _options; /** * Returns current hub. */ private _getCurrentHub?; /** * @inheritDoc * * @param options */ constructor(options?: Partial); /** * @inheritDoc * * @param options */ setupOnce(_: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void; /** * Interceptor function for fetch requests * * @param requestInfo The Fetch API request info * @param response The Fetch API response * @param requestInit The request init object */ private _fetchResponseHandler; /** * Interceptor function for XHR requests * * @param xhr The XHR request * @param method The HTTP method * @param headers The HTTP headers */ private _xhrResponseHandler; /** * Extracts response size from `Content-Length` header when possible * * @param headers * @returns The response size in bytes or undefined */ private _getResponseSizeFromHeaders; /** * Creates an object containing cookies from the given cookie string * * @param cookieString The cookie string to parse * @returns The parsed cookies */ private _parseCookieString; /** * Extracts the headers as an object from the given Fetch API request or response object * * @param headers The headers to extract * @returns The extracted headers as an object */ private _extractFetchHeaders; /** * Extracts the response headers as an object from the given XHR object * * @param xhr The XHR object to extract the response headers from * @returns The response headers as an object */ private _getXHRResponseHeaders; /** * Checks if the given target url is in the given list of targets * * @param target The target url to check * @returns true if the target url is in the given list of targets, false otherwise */ private _isInGivenRequestTargets; /** * Checks if the given status code is in the given range * * @param status The status code to check * @returns true if the status code is in the given range, false otherwise */ private _isInGivenStatusRanges; /** * Wraps `fetch` function to capture request and response data */ private _wrapFetch; /** * Wraps XMLHttpRequest to capture request and response data */ private _wrapXHR; /** * Checks whether given url points to Sentry server * * @param url url to verify */ private _isSentryRequest; /** * Checks whether to capture given response as an event * * @param status response status code * @param url response url */ private _shouldCaptureResponse; /** * Creates a synthetic Sentry event from given response data * * @param data response data * @returns event */ private _createEvent; } export {}; //# sourceMappingURL=httpclient.d.ts.map