@sentry/react-native
Version:
Official Sentry SDK for react-native
42 lines (41 loc) • 2.06 kB
TypeScript
/** Convert a Content-Length header to number/undefined. */
export declare function parseContentLengthHeader(header: string | null | undefined): number | undefined;
export type RequestBody = null | Blob | FormData | URLSearchParams | string | ArrayBuffer | undefined;
/** Get the size of a body. */
export declare function getBodySize(body: RequestBody): number | undefined;
export declare const NETWORK_BODY_MAX_SIZE = 150000;
export declare const DEFAULT_NETWORK_HEADERS: string[];
export interface ResolvedNetworkOptions {
allowUrls: (string | RegExp)[];
denyUrls: (string | RegExp)[];
captureBodies: boolean;
requestHeaders: string[];
responseHeaders: string[];
}
/**
* Whether to capture full network details (headers, bodies) for a given URL,
* based on the allow/deny URL lists.
*/
export declare function shouldCaptureNetworkDetails(url: string | undefined, options: ResolvedNetworkOptions): boolean;
export interface NetworkBody {
body?: string;
/** Warnings about the captured body, e.g. truncation or unserializable type. */
_meta?: {
warnings: string[];
};
}
/**
* Serialize a request/response body to a string, truncated to NETWORK_BODY_MAX_SIZE.
* Returns undefined if the body is empty/missing; returns a meta warning if unserializable
* or truncated.
*/
export declare function getBodyString(body: unknown): NetworkBody | undefined;
/**
* Filter a headers map down to the set explicitly captured (defaults + user-supplied)
* and strip authorization-like headers. Header name comparison is case-insensitive;
* the returned keys are lowercased.
*/
export declare function filterHeaders(headers: Record<string, string | null | undefined> | undefined, extraAllowed: string[]): Record<string, string> | undefined;
/** Parse the raw string returned by XMLHttpRequest.getAllResponseHeaders() into a record. */
export declare function parseAllResponseHeaders(raw: string | null | undefined): Record<string, string>;
//# sourceMappingURL=networkUtils.d.ts.map