import type { UploadedFile, AuthUser } from "../types"; import type { BunResponse } from "./response"; import type { Session, SessionData, SessionStore } from "../middleware/session"; export type TrustProxyValue = boolean | number | string | string[] | ((ip: string, i: number) => boolean); export interface BunWayLogger { info(message: string, meta?: Record): void; warn(message: string, meta?: Record): void; error(message: string, meta?: Record): void; debug?(message: string, meta?: Record): void; } export interface RequestAppContext { get(setting: string): unknown; getLogger(): BunWayLogger; } export interface RangeSpec { start: number; end: number; } export type RangeResult = RangeSpec[] & { type: string; } | -1 | -2; export declare class BunRequest { private _original; private _url; private _pathname; private _params; private _body; private _rawBody; private _bodyParsed; private _cookies; private _signedCookies; private _app?; private _secret; private _socketIp; private _file; private _files; private _res?; private _queryObj; private _acceptCache; private _acceptCharsetCache; private _acceptEncodingCache; private _acceptLanguageCache; locals: Record; timedout: boolean; private _baseUrl; session: Session & SessionData; sessionID: string; sessionStore: SessionStore; user: AuthUser | undefined; auth: AuthUser | undefined; isAuthenticated: () => boolean; isUnauthenticated: () => boolean; login: (user: AuthUser, options?: Record) => Promise; logout: (options?: Record) => Promise; csrfToken: () => string; get secret(): string | undefined; set secret(value: string | undefined); /** * Create a new BunRequest. * @param original - The original Request object * @param pathname - Optional pre-computed pathname (avoids URL parsing) */ constructor(original: Request, pathname?: string); /** * Fast pathname extraction without full URL parsing */ private extractPathname; /** * Get the parsed URL object (lazy initialization) */ private get parsedUrl(); /** * Set the direct socket IP address (from Bun.serve's server.requestIP). * This should be called by the server when creating the request. */ setSocketIp(ip: string | null): void; setBaseUrl(baseUrl: string): void; setApp(app: RequestAppContext): void; setRes(res: BunResponse): void; get app(): RequestAppContext | undefined; get res(): BunResponse | undefined; private getTrustProxy; private shouldTrustProxy; private matchesProxyIp; get method(): string; get url(): string; get path(): string; get pathname(): string; get originalUrl(): string; get baseUrl(): string; get query(): URLSearchParams & Record; get headers(): Headers; get params(): Record; set params(value: Record); get body(): unknown; set body(value: unknown); get hostname(): string; get subdomains(): string[]; set baseUrl(value: string); private _route; get route(): { path: string; method: string; } | null; set route(value: { path: string; method: string; } | null); get protocol(): string; get secure(): boolean; get fresh(): boolean; get stale(): boolean; get ip(): string; get ips(): string[]; get xhr(): boolean; get original(): Request; get cookies(): Record; set cookies(value: Record); get signedCookies(): Record; set signedCookies(value: Record); get file(): UploadedFile | null; set file(value: UploadedFile | null); get files(): UploadedFile[] | Record | null; set files(value: UploadedFile[] | Record | null); private parseCookies; param(name: string): string | undefined; get(header: string): string | undefined; header(name: string): string | undefined; is(...types: string[]): string | false; accepts(...types: string[]): string | false; acceptsCharsets(...charsets: string[]): string | false; acceptsEncodings(...encodings: string[]): string | false; acceptsLanguages(...languages: string[]): string | false; range(size: number, options?: { combine?: boolean; }): RangeResult | undefined; isBodyParsed(): boolean; rawBody(): Promise; rawText(): Promise; parseJson(limit?: number): Promise; parseUrlencoded(limit?: number): Promise>; parseText(limit?: number): Promise; } //# sourceMappingURL=request.d.ts.map