FakeResponse
@tsed/platform-http
Usage
typescript
import { FakeResponse } from "@tsed/platform/platform-http/src/types/testing/FakeResponse";
See /packages/platform/platform-http/src/types/testing/FakeResponse.ts.
Overview
ts
class FakeResponse extends EventEmitter {
headers: Record<string, unknown>;
locals: Record<string, unknown>;
statusCode: number;
data: any;
constructor(opts?: {});
status(code: number): this;
contentType(content: string): void;
contentLength(content: number): void;
redirect(status: number, path: string): void;
location(path: string): void;
get(key: string): unknown;
getHeaders(): Record<string, unknown>;
set(key: string, value: any): this;
setHeader(key: string, value: any): this;
send(data: any): void;
json(data: any): void;
write(chunk: any): void;
end(data: any): void;
}
headers
ts
headers: Record<string, unknown>;
locals
ts
locals: Record<string, unknown>;
statusCode
ts
statusCode: number;
data
ts
data: any;
status
ts
status(code: number): this;
contentType
ts
contentType(content: string): void;
contentLength
ts
contentLength(content: number): void;
redirect
ts
redirect(status: number, path: string): void;
location
ts
location(path: string): void;
get
ts
get(key: string): unknown;
getHeaders
ts
getHeaders(): Record<string, unknown>;
set
ts
set(key: string, value: any): this;
setHeader
ts
setHeader(key: string, value: any): this;
send
ts
send(data: any): void;
json
ts
json(data: any): void;
write
ts
write(chunk: any): void;
end
ts
end(data: any): void;