/// /// import * as internal from 'node:stream'; import { IHttpError, IHttpResponse } from './response.js'; export interface IHttpCookieOpts { maxAge?: number; expires?: Date; path?: string; domain?: string; secure?: boolean; httpOnly?: boolean; sameSite?: 'strict' | 'lax' | 'none' | boolean; signed?: boolean; overwrite?: boolean; } export interface IHttpCookies { get(name: string): string | undefined; set(name: string, value: string, options?: IHttpCookieOpts): any; } export interface IHttpContext { query: HttpRequestQuery; headers: HttpRequestHeaders; cookies: IHttpCookies; params: Record; /** * request body */ body: any; /** * uploaded files */ files: any; host: string; path: string; method: string; url: URL; href: string; origin: string; protocol: string; secure: boolean; ip: string; ips: string[]; response: IHttpResponse; aborted: boolean; is(...types: string[]): string | null | false; accepts(...types: string[]): string | false; getHeader(key: string): string | string[] | undefined; json(data: any, status?: number): void; noContent(): void; created(): void; throw(status: number, message: string): never; abort(status: number, message?: string): void; abort(error: IHttpError): void; reply(response: IHttpResponse): void; view(template: any, data?: any, status?: number): Promise; stream(stream: internal.Readable, mime?: string): void; redirect(url: string, alt?: string): void; /** * @deprecated Use {@link put} instead * @param key * @param value */ set(key: any, value: T): T; put(key: any, value: T): T; value(key: any): T | undefined; } export declare class HttpRequestHeaders { readonly headers: Record; readonly setHeaderCb: (k: string, v: string | string[]) => any; constructor(headers: Record, setHeaderCb: (k: string, v: string | string[]) => any); has(key: string): number | ""; /** * read header value * @param key * @returns {string|undefined} */ get(key: string): string | undefined; value(key: string, defaultValue?: string | null): T; array(key: string): string | (string | string[])[]; all(key: string): string | (string | string[])[]; set(key: string, value: string): void; /** * @added v0.2.12 * @returns */ toObject(): any; } export declare class HttpRequestQuery { readonly query: Record; constructor(query: Record); get(key: string): string | undefined; /** * query string key should be present * @param key * @returns */ present(key: string): boolean; /** * query key should not be empty * @param key * @returns */ has(key: string): boolean; /** * is query key empty * @param key * @returns */ empty(key: string): boolean; array(key: string): string | (string | string[])[]; all(key: string): string | (string | string[])[]; toString(): string; toObject(): any; } export declare class HttpCookies { readonly raw: string; cookies: Record; constructor(raw: string); has(name: string): boolean; get(name: string): any; set(name: string, value: string, opts: IHttpCookieOpts): void; }