import type { ServerResponse } from 'node:http';
import type { Socket } from 'node:net';
import { Writable } from 'node:stream';
export type HttpHeaderOutput = Record<string, string | number | readonly string[]>;
export type HttpWriteHeadHeaders = HttpHeaderOutput | [string, string | number | readonly string[]][];
export declare class HttpResponse extends Writable {
    protected statusCodeValue: number;
    protected chunks: Buffer[];
    protected headerMap: Map<string, string | string[]>;
    get statusCode(): number;
    set statusCode(value: number);
    setHeader(name: string, value: string | number | readonly string[]): this;
    getHeader(name: string): string | string[] | undefined;
    get headers(): Record<string, string>;
    get rawHeaders(): Record<string, string | string[]>;
    get headersSent(): boolean;
    get socket(): Socket | undefined;
    writeHead(statusCode: number, headers?: HttpWriteHeadHeaders): this;
    writeHead(statusCode: number, statusMessage?: string, headers?: HttpWriteHeadHeaders): this;
    flushHeaders(): void;
    redirect(url: string, statusCode?: number): void;
    get body(): Buffer;
    get status(): number;
    get text(): string;
    get bodyString(): string;
    get json(): any;
    /** @internal Keep in-memory observations consistent with Node's HEAD response semantics. */
    discardBody(): void;
    _write(chunk: Buffer | string, _encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
}
export declare class MemoryHttpResponse extends HttpResponse {
}
export declare class NodeHttpResponse extends HttpResponse {
    readonly outgoing: ServerResponse;
    private committed;
    private streaming;
    constructor(outgoing: ServerResponse);
    get headersSent(): boolean;
    get socket(): Socket | undefined;
    setHeader(name: string, value: string | number | readonly string[]): this;
    writeHead(statusCode: number, headers?: HttpWriteHeadHeaders): this;
    writeHead(statusCode: number, statusMessage?: string, headers?: HttpWriteHeadHeaders): this;
    write(chunk: any, encoding?: BufferEncoding | ((error?: Error | null) => void), callback?: (error?: Error | null) => void): boolean;
    _write(chunk: Buffer | string, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
    _final(callback: (error?: Error | null) => void): void;
    destroy(error?: Error): this;
    redirect(url: string, statusCode?: number): void;
    flush(): void;
    flushHeaders(): void;
    private commitHeaders;
}
export interface HttpResponseResult {
    writeTo(response: HttpResponse): void;
}
export declare class JsonResponseResult implements HttpResponseResult {
    readonly value: unknown;
    readonly statusCode: number;
    constructor(value: unknown, statusCode?: number);
    writeTo(response: HttpResponse): void;
}
export declare class RedirectResponseResult implements HttpResponseResult {
    readonly url: string;
    readonly statusCode: number;
    constructor(url: string, statusCode?: number);
    writeTo(response: HttpResponse): void;
}
export declare class EmptyResponseResult implements HttpResponseResult {
    readonly statusCode: number;
    constructor(statusCode?: number);
    writeTo(response: HttpResponse): void;
}
export declare class RawResponseResult implements HttpResponseResult {
    readonly body: string | Buffer;
    readonly options: {
        statusCode?: number;
        contentType?: string;
        headers?: Record<string, string | number | string[]>;
    };
    constructor(body: string | Buffer, options?: {
        statusCode?: number;
        contentType?: string;
        headers?: Record<string, string | number | string[]>;
    });
    writeTo(response: HttpResponse): void;
}
export declare function jsonResponse(value: unknown, statusCode?: number): JsonResponseResult;
export declare function redirectResponse(url: string, statusCode?: number): RedirectResponseResult;
export declare class Redirect {
    static toUrl(url: string, statusCode?: number): RedirectResponseResult;
}
export declare function emptyResponse(statusCode?: number): EmptyResponseResult;
export declare function rawResponse(body: string | Buffer, options?: {
    statusCode?: number;
    contentType?: string;
    headers?: Record<string, string | number | string[]>;
}): RawResponseResult;
export declare function isHttpResponseResult(value: unknown): value is HttpResponseResult;
//# sourceMappingURL=response.d.ts.map