zents
Version:
ZenTS is a Node.js & TypeScript MVC-Framework for building rich web applications, released as free and open-source software under the MIT License. It is designed for building web applications with modern tools and design patterns.
36 lines (35 loc) • 1.2 kB
TypeScript
/// <reference types="node" />
import type { Cookie } from './Cookie';
import type { JsonValue } from 'type-fest';
import type { Request } from './Request';
import { ResponseHeader } from './ResponseHeader';
import type { ServerResponse } from 'http';
import type { Stream } from 'stream';
export declare class Response {
nodeRes: ServerResponse;
private req;
private cookie;
header: ResponseHeader;
isSend: boolean;
isStatuscodeSetManual: boolean;
private bodyType;
private _body;
constructor(nodeRes: ServerResponse, req: Request, cookie: Cookie);
send(): void;
json<T extends JsonValue>(data: T): this;
html(html: string): this;
text(text: string): this;
buffer(buffer: Buffer): this;
stream(stream: Stream): this;
redirect(url: string, statusCode?: number): void;
getStatusCode(): number;
setStatusCode(statusCode: number): this;
getStatusMessage(): string;
setStatusMessage(message: string): this;
private setCookies;
private getStatusMessageFromStatusCode;
private sendJsonResponse;
private sendBufferOrStreamResponse;
private sendDefaultResponse;
private setContentLengthByByteLength;
}