UNPKG

@dooboostore/simple-boot-http-server

Version:

back end http server frameworks

102 lines 4.71 kB
import { IncomingMessage, OutgoingHttpHeader, OutgoingHttpHeaders, ServerResponse } from 'http'; import { HttpHeaders } from '../codes/HttpHeaders'; import { Mimes } from '../codes/Mimes'; import { Intent } from '@dooboostore/simple-boot/intent/Intent'; import { URL, URLSearchParams } from 'url'; import { Buffer } from 'buffer'; import { MultipartData } from './datas/MultipartData'; import { ReqFormUrlBody } from './datas/body/ReqFormUrlBody'; import { ReqJsonBody } from './datas/body/ReqJsonBody'; import { ReqHeader } from './datas/ReqHeader'; import { HttpStatus } from '../codes/HttpStatus'; import { SessionManager } from '../session/SessionManager'; import { HttpServerOption } from '../option/HttpServerOption'; type Config = { sessionManager?: SessionManager; option: HttpServerOption; }; export declare class RequestResponse { protected resWriteChunk: string | Buffer | undefined; protected reqBodyChunk?: Buffer; protected req: IncomingMessage; protected res: ServerResponse; protected config: Config; constructor(req: IncomingMessage | RequestResponse, res: ServerResponse, config: Config); get reqSocket(): import("net").Socket; get reqCookieMap(): Map<string, string>; reqCookieGet(key: string): string; get reqRemoteAddress(): string | undefined; get reqUrlObject(): URL; get reqUrlPathName(): string; get reqUrl(): string; reqUrlObj(config?: { scheme?: string; host?: string; }): URL; get reqUrlSearchParamTuples(): [string, string][]; get reqUrlSearchParams(): URLSearchParams; get reqUrlSearchParamsObj(): { [p: string]: { [p: string]: any; }; }; get reqPathSearchParamUrl(): string; get reqReadable(): boolean; get reqIntent(): Intent<any, any>; reqHasContentTypeHeader(mime: Mimes | string): boolean; reqHasAcceptHeader(mime: Mimes | string): boolean; reqBodyData(): Promise<Buffer>; resBodyData(): string | Buffer | undefined; reqBodyMultipartFormDataObject<T>(): Promise<T>; reqBodyMultipartFormData(): Promise<MultipartData[]>; reqBodyStringData(): Promise<string>; reqBodyJsonData<T>(): Promise<T>; reqBodyFormUrlData<T>(): Promise<T>; reqBodyReqFormUrlBody(): Promise<ReqFormUrlBody>; reqBodyReqJsonBody(): Promise<ReqJsonBody>; resBodyJsonData<T>(): (T | null); resBodyStringData(): string; reqMethod(): string; reqHeader(key: HttpHeaders | string): string | string[]; get reqHost(): string; get reqHeaderObj(): ReqHeader; reqHeaderFirst(key: HttpHeaders | string, defaultValue?: string): string; reqAuthorizationHeader(): string; reqRefreshTokenHeader(): string; resStatusCode(code?: undefined): number; resStatusCode(code: number | HttpStatus): RequestResponseChain<number>; resHeader(key: HttpHeaders | string): string | number | string[]; resHeaderFirst(key: HttpHeaders | string, defaultValue?: string): string | number | string[]; reqSession(): Promise<{ [key: string]: any; }>; reqSessionSet(key: string, value: any): void; reqSessionGet<T = any>(key: string): T | undefined; resSetStatusCode(statusCode: number): RequestResponseChain<number>; resWrite(chunk: string | Buffer | any, encoding?: BufferEncoding): RequestResponseChain<string | Buffer<ArrayBufferLike>>; resWriteJson(chunk: any, encoding?: BufferEncoding): RequestResponseChain<string | Buffer<ArrayBufferLike>>; resSetHeader(key: HttpHeaders | string, value: string | string[]): RequestResponseChain<ServerResponse<IncomingMessage>>; resAddHeader(key: HttpHeaders | string, value: string | string[]): RequestResponseChain<ServerResponse<IncomingMessage>>; resSetHeaders(headers: { [key: string]: string | string[]; }): RequestResponseChain<any>; resAddHeaders(headers: { [key: string]: string | string[]; }): RequestResponseChain<any>; private resEndChunk; resEnd(chunk?: string | Buffer): Promise<void>; resWriteHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[] | { [key: string]: string | string[]; }): RequestResponseChain<ServerResponse<IncomingMessage>>; resWriteHeadEnd(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[] | { [key: string]: string | string[]; }): void; resIsDone(): boolean; createRequestResponseChain<T = any>(data?: T): RequestResponseChain<T>; } export declare class RequestResponseChain<T> extends RequestResponse { result?: T; constructor(req: IncomingMessage, res: ServerResponse, config: Config, result?: T); } export {}; //# sourceMappingURL=RequestResponse.d.ts.map