UNPKG

playwright-fluent

Version:
69 lines (68 loc) 2.29 kB
import { Request } from 'playwright'; export declare type HttpRequestMethod = 'CONNECT' | 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT' | 'TRACE'; export declare type MimeType = 'application/javascript' | 'application/json' | 'application/json; charset=UTF-8' | 'application/x-www-form-urlencoded; charset=UTF-8' | 'font/woff2' | 'image/gif' | 'image/jpeg' | 'image/png' | 'image/vnd.microsoft.icon' | 'image/webp' | 'text/css' | 'text/html; charset=utf-8' | 'text/html' | 'text/javascript' | 'text/plain'; export interface HarPage { startedDateTime: string; id: string; title: string; } export interface HarEntry { startedDateTime: string; request: HarRequest; response: HarResponse; } export interface HarRequest { method: HttpRequestMethod; url: string; headers: HarHeader[]; queryString: NameValue[]; postData: HarPostData; } export interface HarPostData { mimeType: MimeType; text: string; } export interface HarHeader { name: string; value: string; } export interface NameValue { name: string; value: string; } export interface HarResponse { status: number; statusText: string; httpVersion: string; headers: HarHeader[]; content: { mimeType: MimeType; text: string; encoding: 'base64'; }; } export interface HarData { log: { version: string; creator: { name: string; version: string; }; browser: { name: string; version: string; }; pages: HarPage[]; entries: HarEntry[]; }; } export declare function extractQueryStringObjectFromHarQueryString(harQueryString: NameValue[]): { [key: string]: string; }; export declare function areUrlEquals(url1: string, url2: string): boolean; export interface HarEntryParserOptions { areUrlEquals: (url1: string, url2: string) => boolean; } export declare const defaultHarEntryParserOptions: HarEntryParserOptions; export declare function getHarEntryFor(request: Request, harData: HarData, options?: Partial<HarEntryParserOptions>): HarEntry | undefined; export declare function getHarResponseFor(request: Request, harData: HarData, options?: Partial<HarEntryParserOptions>): HarResponse | undefined;