import type { DevToolsProtocol, Header } from "./types/HttpArchiveFormat.ts"; /** * Calculate the size of an HTTP request header represented by a HAR request. * * For clarity (certainly not efficiency!), it does this this by re-generating the * request format and taking the length. * * The white space on each field lin between the colon ":" that follows the * header name and the header value, is "optional white space (OWS)" in the spec. * We can't be sure the header that generated this request contained exactly one space * after each colon. It is a very strong convention, but it would be follow to assume * as a certainly as the convention is easy to defy. * * This code should never be copied into any application that would assume it correctly * calculates the length of that portion of a message buffer. * * For reference on the request format: * https://httpwg.org/specs/rfc9112.html#message.format * https://developer.mozilla.org/en-US/docs/Glossary/HTTP_header * * @param harRequest * @returns An approximation of size in bytes of the request header that generated * this HAR request, which will be accurate if the request followed norms that * are not formal conventions. */ export declare const calculateRequestHeaderSize: ({ method, url, httpVersion, headers }: { method: string; url: string; httpVersion: string; headers: DevToolsProtocol.Network.Headers; }) => number; export declare const calculateResponseHeaderSize: ({ protocol, status, statusText, headers }: DevToolsProtocol.Network.Response & Partial) => number; export declare const sortHarHeadersByName: (headers: Header[]) => Header[]; /** * Turn headers of the from of a {[name: string]: string} object into an array of Har Header objects * with all header names in lowercase. * * @param headers Headers in the form returned by the Chrome DevTools Protocol, which are JavaScript * objects with header names as keys and values as property values. Some CDP apis used mixed case for * names and some use lowercase, so we'll make them all lowercase. */ export declare const headersRecordToArrayOfHarHeaders: >(headers?: T) => Header[]; /** * Perform case-insensitive search for a header in a headers object. */ export declare const getHarHeaderValue: (headers: Header[] | undefined, headerToFind: string) => string | undefined; export declare const getHeaderValue: (headers: DevToolsProtocol.Network.Headers, headerToFind: string) => string | undefined;