/** * E2E Test Runner - HTTP Adapter * * HTTP client for REST API testing */ import type { AdapterConfig, AdapterContext, AdapterStepResult } from '../types'; import { BaseAdapter } from './base.adapter'; import { type BaseAssertion } from '../assertions/assertion-runner'; export interface MultipartField { /** Field name (required). */ name: string; /** File path to read and attach as a binary upload. */ file?: string; /** Text field value. */ value?: string; /** Override for the uploaded filename (defaults to basename of file path). */ filename?: string; /** MIME type override for file uploads. */ contentType?: string; } export interface HTTPRequestParams { method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS'; url: string; headers?: Record; body?: unknown; query?: Record; timeout?: number; followRedirects?: boolean; capture?: Record; assert?: HTTPAssertion; /** Multipart/form-data fields. Mutually exclusive with body. */ multipart?: MultipartField[]; } export interface HTTPResponse { status: number; statusText: string; headers: Record; body: unknown; duration: number; } export interface HTTPAssertion { status?: number | number[]; statusRange?: [number, number]; headers?: Record; json?: JSONPathAssertion[]; body?: { contains?: string; matches?: string; equals?: string; }; duration?: { lessThan?: number; greaterThan?: number; }; } export interface JSONPathAssertion extends BaseAssertion { path: string; } export declare class HTTPAdapter extends BaseAdapter { private baseUrl; private defaultHeaders; private defaultTimeout; constructor(config: AdapterConfig, logger: import('../types').Logger); get name(): string; connect(): Promise; disconnect(): Promise; execute(action: string, params: Record, ctx: AdapterContext): Promise; healthCheck(): Promise; /** * Execute an HTTP request */ request(params: HTTPRequestParams, ctx: AdapterContext): Promise; /** * Build full URL with query parameters */ private buildUrl; /** * Build a FormData body from multipart field definitions. * * Each entry must have `name` and either `file` (path) or `value` (text). * File entries are read from disk and appended as Blob with optional * custom filename and content type. */ private buildMultipartBody; /** * Format and log HTTP response for debug mode */ private logHttpResponse; /** * Build request headers */ private buildHeaders; /** * Parse Set-Cookie headers and store in the cookie jar */ private storeCookies; /** * Handle value captures from response */ private handleCaptures; /** * Evaluate a JSONPath expression * Supports full JSONPath syntax including array indexing: $.errors[0].code */ private evaluateJSONPath; /** * Run assertions on HTTP response */ private runAssertions; /** * Run a single JSON path assertion using shared runner */ private runJSONAssertion; } //# sourceMappingURL=http.adapter.d.ts.map