UNPKG

1.53 kBTypeScriptView Raw
1/// <reference types="node" />
2import { HttpServer, RequestMethod } from '@nestjs/common';
3import { IncomingMessage } from 'http';
4import { Observable } from 'rxjs';
5import { AdditionalHeaders, WritableHeaderStream } from './sse-stream';
6export interface CustomHeader {
7 name: string;
8 value: string;
9}
10export interface RedirectResponse {
11 url: string;
12 statusCode?: number;
13}
14export declare class RouterResponseController {
15 private readonly applicationRef;
16 private readonly logger;
17 constructor(applicationRef: HttpServer);
18 apply<TInput = any, TResponse = any>(result: TInput, response: TResponse, httpStatusCode?: number): Promise<any>;
19 redirect<TInput = any, TResponse = any>(resultOrDeferred: TInput, response: TResponse, redirectResponse: RedirectResponse): Promise<void>;
20 render<TInput = unknown, TResponse = unknown>(resultOrDeferred: TInput, response: TResponse, template: string): Promise<any>;
21 transformToResult(resultOrDeferred: any): Promise<any>;
22 getStatusByMethod(requestMethod: RequestMethod): number;
23 setHeaders<TResponse = unknown>(response: TResponse, headers: CustomHeader[]): void;
24 setStatus<TResponse = unknown>(response: TResponse, statusCode: number): void;
25 sse<TInput extends Observable<unknown> = any, TResponse extends WritableHeaderStream = any, TRequest extends IncomingMessage = any>(result: TInput, response: TResponse, request: TRequest, options?: {
26 additionalHeaders: AdditionalHeaders;
27 }): void;
28 private assertObservable;
29}