1 | import { RawReplyDefaultExpression, RawServerBase, RawServerDefault, ContextConfigDefault, RawRequestDefaultExpression, ReplyDefault } from './utils'
|
2 | import { FastifyContext } from './context'
|
3 | import { FastifyLoggerInstance } from './logger'
|
4 | import { FastifyRequest } from './request'
|
5 | import { RouteGenericInterface } from './route'
|
6 |
|
7 | export interface ReplyGenericInterface {
|
8 | Reply?: ReplyDefault;
|
9 | }
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | export interface FastifyReply<
|
16 | RawServer extends RawServerBase = RawServerDefault,
|
17 | RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
18 | RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
19 | RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
20 | ContextConfig = ContextConfigDefault,
|
21 | > {
|
22 | raw: RawReply;
|
23 | context: FastifyContext<ContextConfig>;
|
24 | log: FastifyLoggerInstance;
|
25 | request: FastifyRequest<RouteGeneric, RawServer, RawRequest>;
|
26 | code(statusCode: number): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>;
|
27 | status(statusCode: number): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>;
|
28 | statusCode: number;
|
29 | sent: boolean;
|
30 | send(payload?: RouteGeneric['Reply']): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>;
|
31 | header(key: string, value: any): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>;
|
32 | headers(values: {[key: string]: any}): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>;
|
33 | getHeader(key: string): string | undefined;
|
34 | getHeaders(): {
|
35 |
|
36 | [key: string]: number | string | string[] | undefined;
|
37 | };
|
38 | removeHeader(key: string): void;
|
39 | hasHeader(key: string): boolean;
|
40 |
|
41 | redirect(statusCode: number, url: string): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>;
|
42 | redirect(url: string): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>;
|
43 | callNotFound(): void;
|
44 | getResponseTime(): number;
|
45 | type(contentType: string): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>;
|
46 | serializer(fn: (payload: any) => string): FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>;
|
47 | serialize(payload: any): string;
|
48 | then(fullfilled: () => void, rejected: (err: Error) => void): void;
|
49 | }
|