/** * RequestLineParser * * Parses HTTP request lines (method, URL) and header lines. * Handles all standard HTTP methods and header parsing. * * Supported syntax: * - METHOD URL [HTTP/version] * - Header-Name: header-value */ import { HttpMethod } from '../types'; /** * Result from parsing a method line */ export interface RequestLineResult { method: HttpMethod; url: string; } /** * Result from parsing a header line */ export interface HeaderResult { key: string; value: string; } /** * Result from parsing multiple lines */ export interface ParsedLinesResult { method: HttpMethod | null; url: string | null; headers: HeaderResult[]; /** Index where body content starts (after empty line) */ bodyStartIndex: number | null; } export declare class RequestLineParser { /** * Regex pattern for detecting HTTP method lines */ private static readonly METHOD_PATTERN; /** * Check if a line is an HTTP method line */ isMethodLine(line: string): boolean; /** * Parse a method line to extract method and URL */ parseMethodLine(line: string): RequestLineResult | null; /** * Check if a line is a header line */ isHeaderLine(line: string): boolean; /** * Parse a header line to extract key and value */ parseHeaderLine(line: string): HeaderResult | null; /** * Parse multiple lines to extract method, URL, and headers * Stops at empty line (body start) */ parseLines(lines: string[]): ParsedLinesResult; /** * Check if a line is an HTTP method line */ static isMethodLine(line: string): boolean; /** * Parse a method line to extract method and URL */ static parseMethodLine(line: string): RequestLineResult | null; /** * Check if a line is a header line */ static isHeaderLine(line: string): boolean; /** * Parse a header line to extract key and value */ static parseHeaderLine(line: string): HeaderResult | null; }