fastify 3.27.2 → 3.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/Reference/Reply.md +49 -0
- package/fastify.js +1 -1
- package/lib/errors.js +8 -0
- package/lib/fourOhFour.js +20 -1
- package/lib/reply.js +96 -9
- package/lib/symbols.js +1 -0
- package/package.json +1 -1
- package/test/404s.test.js +52 -0
- package/test/internals/reply.test.js +16 -14
- package/test/logger.test.js +20 -0
- package/test/reply-trailers.test.js +277 -0
- package/test/types/hooks.test-d.ts +52 -2
- package/test/types/request.test-d.ts +41 -1
- package/types/.eslintrc.json +3 -1
- package/types/hooks.d.ts +85 -61
- package/types/instance.d.ts +54 -38
- package/types/request.d.ts +2 -1
- package/types/route.d.ts +35 -30
package/types/hooks.d.ts
CHANGED
|
@@ -26,11 +26,12 @@ export interface onRequestHookHandler<
|
|
|
26
26
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
27
27
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
28
28
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
29
|
-
ContextConfig = ContextConfigDefault
|
|
29
|
+
ContextConfig = ContextConfigDefault,
|
|
30
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
30
31
|
> {
|
|
31
32
|
(
|
|
32
|
-
this: FastifyInstance,
|
|
33
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
33
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
34
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
34
35
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
35
36
|
done: HookHandlerDoneFunction
|
|
36
37
|
): void;
|
|
@@ -41,11 +42,12 @@ export interface onRequestAsyncHookHandler<
|
|
|
41
42
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
42
43
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
43
44
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
44
|
-
ContextConfig = ContextConfigDefault
|
|
45
|
+
ContextConfig = ContextConfigDefault,
|
|
46
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
45
47
|
> {
|
|
46
48
|
(
|
|
47
|
-
this: FastifyInstance,
|
|
48
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
49
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
50
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
49
51
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
50
52
|
): Promise<unknown>;
|
|
51
53
|
}
|
|
@@ -59,11 +61,12 @@ export interface preParsingHookHandler<
|
|
|
59
61
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
60
62
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
61
63
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
62
|
-
ContextConfig = ContextConfigDefault
|
|
64
|
+
ContextConfig = ContextConfigDefault,
|
|
65
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
63
66
|
> {
|
|
64
67
|
(
|
|
65
|
-
this: FastifyInstance,
|
|
66
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
68
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
69
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
67
70
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
68
71
|
payload: RequestPayload,
|
|
69
72
|
done: <TError extends Error = FastifyError>(err?: TError | null, res?: RequestPayload) => void
|
|
@@ -75,11 +78,12 @@ export interface preParsingAsyncHookHandler<
|
|
|
75
78
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
76
79
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
77
80
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
78
|
-
ContextConfig = ContextConfigDefault
|
|
81
|
+
ContextConfig = ContextConfigDefault,
|
|
82
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
79
83
|
> {
|
|
80
84
|
(
|
|
81
|
-
this: FastifyInstance,
|
|
82
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
85
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
86
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
83
87
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
84
88
|
payload: RequestPayload,
|
|
85
89
|
): Promise<RequestPayload | unknown>;
|
|
@@ -93,11 +97,12 @@ export interface preValidationHookHandler<
|
|
|
93
97
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
94
98
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
95
99
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
96
|
-
ContextConfig = ContextConfigDefault
|
|
100
|
+
ContextConfig = ContextConfigDefault,
|
|
101
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
97
102
|
> {
|
|
98
103
|
(
|
|
99
|
-
this: FastifyInstance,
|
|
100
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
104
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
105
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
101
106
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
102
107
|
done: HookHandlerDoneFunction
|
|
103
108
|
): void;
|
|
@@ -108,11 +113,12 @@ export interface preValidationAsyncHookHandler<
|
|
|
108
113
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
109
114
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
110
115
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
111
|
-
ContextConfig = ContextConfigDefault
|
|
116
|
+
ContextConfig = ContextConfigDefault,
|
|
117
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
112
118
|
> {
|
|
113
119
|
(
|
|
114
|
-
this: FastifyInstance,
|
|
115
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
120
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
121
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
116
122
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
117
123
|
): Promise<unknown>;
|
|
118
124
|
}
|
|
@@ -125,11 +131,12 @@ export interface preHandlerHookHandler<
|
|
|
125
131
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
126
132
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
127
133
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
128
|
-
ContextConfig = ContextConfigDefault
|
|
134
|
+
ContextConfig = ContextConfigDefault,
|
|
135
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
129
136
|
> {
|
|
130
137
|
(
|
|
131
|
-
this: FastifyInstance,
|
|
132
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
138
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
139
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
133
140
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
134
141
|
done: HookHandlerDoneFunction
|
|
135
142
|
): void;
|
|
@@ -140,11 +147,12 @@ export interface preHandlerAsyncHookHandler<
|
|
|
140
147
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
141
148
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
142
149
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
143
|
-
ContextConfig = ContextConfigDefault
|
|
150
|
+
ContextConfig = ContextConfigDefault,
|
|
151
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
144
152
|
> {
|
|
145
153
|
(
|
|
146
|
-
this: FastifyInstance,
|
|
147
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
154
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
155
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
148
156
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
149
157
|
): Promise<unknown>;
|
|
150
158
|
}
|
|
@@ -166,11 +174,12 @@ export interface preSerializationHookHandler<
|
|
|
166
174
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
167
175
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
168
176
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
169
|
-
ContextConfig = ContextConfigDefault
|
|
177
|
+
ContextConfig = ContextConfigDefault,
|
|
178
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
170
179
|
> {
|
|
171
180
|
(
|
|
172
|
-
this: FastifyInstance,
|
|
173
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
181
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
182
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
174
183
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
175
184
|
payload: PreSerializationPayload,
|
|
176
185
|
done: DoneFuncWithErrOrRes
|
|
@@ -183,11 +192,12 @@ export interface preSerializationAsyncHookHandler<
|
|
|
183
192
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
184
193
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
185
194
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
186
|
-
ContextConfig = ContextConfigDefault
|
|
195
|
+
ContextConfig = ContextConfigDefault,
|
|
196
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
187
197
|
> {
|
|
188
198
|
(
|
|
189
|
-
this: FastifyInstance,
|
|
190
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
199
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
200
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
191
201
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
192
202
|
payload: PreSerializationPayload
|
|
193
203
|
): Promise<unknown>;
|
|
@@ -203,11 +213,12 @@ export interface onSendHookHandler<
|
|
|
203
213
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
204
214
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
205
215
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
206
|
-
ContextConfig = ContextConfigDefault
|
|
216
|
+
ContextConfig = ContextConfigDefault,
|
|
217
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
207
218
|
> {
|
|
208
219
|
(
|
|
209
|
-
this: FastifyInstance,
|
|
210
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
220
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
221
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
211
222
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
212
223
|
payload: OnSendPayload,
|
|
213
224
|
done: DoneFuncWithErrOrRes
|
|
@@ -220,11 +231,12 @@ export interface onSendAsyncHookHandler<
|
|
|
220
231
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
221
232
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
222
233
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
223
|
-
ContextConfig = ContextConfigDefault
|
|
234
|
+
ContextConfig = ContextConfigDefault,
|
|
235
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
224
236
|
> {
|
|
225
237
|
(
|
|
226
|
-
this: FastifyInstance,
|
|
227
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
238
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
239
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
228
240
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
229
241
|
payload: OnSendPayload,
|
|
230
242
|
): Promise<unknown>;
|
|
@@ -239,11 +251,12 @@ export interface onResponseHookHandler<
|
|
|
239
251
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
240
252
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
241
253
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
242
|
-
ContextConfig = ContextConfigDefault
|
|
254
|
+
ContextConfig = ContextConfigDefault,
|
|
255
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
243
256
|
> {
|
|
244
257
|
(
|
|
245
|
-
this: FastifyInstance,
|
|
246
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
258
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
259
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
247
260
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
248
261
|
done: HookHandlerDoneFunction
|
|
249
262
|
): void;
|
|
@@ -254,11 +267,12 @@ export interface onResponseAsyncHookHandler<
|
|
|
254
267
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
255
268
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
256
269
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
257
|
-
ContextConfig = ContextConfigDefault
|
|
270
|
+
ContextConfig = ContextConfigDefault,
|
|
271
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
258
272
|
> {
|
|
259
273
|
(
|
|
260
|
-
this: FastifyInstance,
|
|
261
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
274
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
275
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
262
276
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
263
277
|
): Promise<unknown>;
|
|
264
278
|
}
|
|
@@ -272,11 +286,12 @@ export interface onTimeoutHookHandler<
|
|
|
272
286
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
273
287
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
274
288
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
275
|
-
ContextConfig = ContextConfigDefault
|
|
289
|
+
ContextConfig = ContextConfigDefault,
|
|
290
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
276
291
|
> {
|
|
277
292
|
(
|
|
278
|
-
this: FastifyInstance,
|
|
279
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
293
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
294
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
280
295
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
281
296
|
done: HookHandlerDoneFunction
|
|
282
297
|
): void;
|
|
@@ -287,11 +302,12 @@ export interface onTimeoutAsyncHookHandler<
|
|
|
287
302
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
288
303
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
289
304
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
290
|
-
ContextConfig = ContextConfigDefault
|
|
305
|
+
ContextConfig = ContextConfigDefault,
|
|
306
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
291
307
|
> {
|
|
292
308
|
(
|
|
293
|
-
this: FastifyInstance,
|
|
294
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
309
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
310
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
295
311
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
296
312
|
): Promise<unknown>;
|
|
297
313
|
}
|
|
@@ -308,11 +324,12 @@ export interface onErrorHookHandler<
|
|
|
308
324
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
309
325
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
310
326
|
ContextConfig = ContextConfigDefault,
|
|
311
|
-
TError extends Error = FastifyError
|
|
327
|
+
TError extends Error = FastifyError,
|
|
328
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
312
329
|
> {
|
|
313
330
|
(
|
|
314
|
-
this: FastifyInstance,
|
|
315
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
331
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
332
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
316
333
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
317
334
|
error: TError,
|
|
318
335
|
done: () => void
|
|
@@ -325,11 +342,12 @@ export interface onErrorAsyncHookHandler<
|
|
|
325
342
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
326
343
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
327
344
|
ContextConfig = ContextConfigDefault,
|
|
328
|
-
TError extends Error = FastifyError
|
|
345
|
+
TError extends Error = FastifyError,
|
|
346
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
329
347
|
> {
|
|
330
348
|
(
|
|
331
|
-
this: FastifyInstance,
|
|
332
|
-
request: FastifyRequest<RouteGeneric, RawServer, RawRequest>,
|
|
349
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
350
|
+
request: FastifyRequest<RouteGeneric, RawServer, RawRequest, ContextConfig, Logger>,
|
|
333
351
|
reply: FastifyReply<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>,
|
|
334
352
|
error: TError
|
|
335
353
|
): Promise<unknown>;
|
|
@@ -345,10 +363,11 @@ export interface onRouteHookHandler<
|
|
|
345
363
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
346
364
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
347
365
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
348
|
-
ContextConfig = ContextConfigDefault
|
|
366
|
+
ContextConfig = ContextConfigDefault,
|
|
367
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
349
368
|
> {
|
|
350
369
|
(
|
|
351
|
-
this: FastifyInstance,
|
|
370
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
352
371
|
opts: RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig> & { routePath: string; path: string; prefix: string }
|
|
353
372
|
): Promise<unknown> | void;
|
|
354
373
|
}
|
|
@@ -362,7 +381,7 @@ export interface onRegisterHookHandler<
|
|
|
362
381
|
RawServer extends RawServerBase = RawServerDefault,
|
|
363
382
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
364
383
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
365
|
-
Logger = FastifyLoggerInstance,
|
|
384
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
|
|
366
385
|
Options extends FastifyPluginOptions = FastifyPluginOptions
|
|
367
386
|
> {
|
|
368
387
|
(
|
|
@@ -375,9 +394,14 @@ export interface onRegisterHookHandler<
|
|
|
375
394
|
/**
|
|
376
395
|
* Triggered when fastify.listen() or fastify.ready() is invoked to start the server. It is useful when plugins need a "ready" event, for example to load data before the server start listening for requests.
|
|
377
396
|
*/
|
|
378
|
-
export interface onReadyHookHandler
|
|
397
|
+
export interface onReadyHookHandler<
|
|
398
|
+
RawServer extends RawServerBase = RawServerDefault,
|
|
399
|
+
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
400
|
+
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
401
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
|
|
402
|
+
> {
|
|
379
403
|
(
|
|
380
|
-
this: FastifyInstance,
|
|
404
|
+
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
381
405
|
done: HookHandlerDoneFunction
|
|
382
406
|
): void;
|
|
383
407
|
}
|
|
@@ -394,7 +418,7 @@ export interface onCloseHookHandler<
|
|
|
394
418
|
RawServer extends RawServerBase = RawServerDefault,
|
|
395
419
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
396
420
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
397
|
-
Logger = FastifyLoggerInstance
|
|
421
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
|
|
398
422
|
> {
|
|
399
423
|
(
|
|
400
424
|
instance: FastifyInstance<RawServer, RawRequest, RawReply, Logger>,
|
|
@@ -406,7 +430,7 @@ export interface onCloseAsyncHookHandler<
|
|
|
406
430
|
RawServer extends RawServerBase = RawServerDefault,
|
|
407
431
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
408
432
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
409
|
-
Logger = FastifyLoggerInstance
|
|
433
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
|
|
410
434
|
> {
|
|
411
435
|
(
|
|
412
436
|
instance: FastifyInstance<RawServer, RawRequest, RawReply, Logger>
|
package/types/instance.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface FastifyInstance<
|
|
|
29
29
|
RawServer extends RawServerBase = RawServerDefault,
|
|
30
30
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
31
31
|
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
|
|
32
|
-
Logger = FastifyLoggerInstance
|
|
32
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
33
33
|
> {
|
|
34
34
|
server: RawServer;
|
|
35
35
|
prefix: string;
|
|
@@ -83,7 +83,7 @@ export interface FastifyInstance<
|
|
|
83
83
|
listen(opts: { port: number; host?: string; backlog?: number }, callback: (err: Error|null, address: string) => void): void;
|
|
84
84
|
listen(opts: { port: number; host?: string; backlog?: number }): Promise<string>;
|
|
85
85
|
|
|
86
|
-
ready(): FastifyInstance<RawServer, RawRequest, RawReply> & PromiseLike<undefined>;
|
|
86
|
+
ready(): FastifyInstance<RawServer, RawRequest, RawReply, Logger> & PromiseLike<undefined>;
|
|
87
87
|
ready(readyListener: (err: Error) => void): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
88
88
|
|
|
89
89
|
register: FastifyRegister<FastifyInstance<RawServer, RawRequest, RawReply, Logger> & PromiseLike<undefined>>;
|
|
@@ -96,7 +96,7 @@ export interface FastifyInstance<
|
|
|
96
96
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
97
97
|
ContextConfig = ContextConfigDefault,
|
|
98
98
|
SchemaCompiler = FastifySchema,
|
|
99
|
-
>(opts: RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler>): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
99
|
+
>(opts: RouteOptions<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, SchemaCompiler, Logger>): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
100
100
|
|
|
101
101
|
get: RouteShorthandMethod<RawServer, RawRequest, RawReply>;
|
|
102
102
|
head: RouteShorthandMethod<RawServer, RawRequest, RawReply>;
|
|
@@ -117,10 +117,11 @@ export interface FastifyInstance<
|
|
|
117
117
|
*/
|
|
118
118
|
addHook<
|
|
119
119
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
120
|
-
ContextConfig = ContextConfigDefault
|
|
120
|
+
ContextConfig = ContextConfigDefault,
|
|
121
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
121
122
|
>(
|
|
122
123
|
name: 'onRequest',
|
|
123
|
-
hook: onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
124
|
+
hook: onRequestHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
124
125
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
125
126
|
|
|
126
127
|
addHook<
|
|
@@ -128,7 +129,7 @@ export interface FastifyInstance<
|
|
|
128
129
|
ContextConfig = ContextConfigDefault
|
|
129
130
|
>(
|
|
130
131
|
name: 'onRequest',
|
|
131
|
-
hook: onRequestAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
132
|
+
hook: onRequestAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
132
133
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
133
134
|
|
|
134
135
|
/**
|
|
@@ -140,7 +141,7 @@ export interface FastifyInstance<
|
|
|
140
141
|
ContextConfig = ContextConfigDefault
|
|
141
142
|
>(
|
|
142
143
|
name: 'preParsing',
|
|
143
|
-
hook: preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
144
|
+
hook: preParsingHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
144
145
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
145
146
|
|
|
146
147
|
addHook<
|
|
@@ -148,7 +149,7 @@ export interface FastifyInstance<
|
|
|
148
149
|
ContextConfig = ContextConfigDefault
|
|
149
150
|
>(
|
|
150
151
|
name: 'preParsing',
|
|
151
|
-
hook: preParsingAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
152
|
+
hook: preParsingAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
152
153
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
153
154
|
|
|
154
155
|
/**
|
|
@@ -156,18 +157,20 @@ export interface FastifyInstance<
|
|
|
156
157
|
*/
|
|
157
158
|
addHook<
|
|
158
159
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
159
|
-
ContextConfig = ContextConfigDefault
|
|
160
|
+
ContextConfig = ContextConfigDefault,
|
|
161
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
160
162
|
>(
|
|
161
163
|
name: 'preValidation',
|
|
162
|
-
hook: preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
164
|
+
hook: preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
163
165
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
164
166
|
|
|
165
167
|
addHook<
|
|
166
168
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
167
|
-
ContextConfig = ContextConfigDefault
|
|
169
|
+
ContextConfig = ContextConfigDefault,
|
|
170
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
168
171
|
>(
|
|
169
172
|
name: 'preValidation',
|
|
170
|
-
hook: preValidationAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
173
|
+
hook: preValidationAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
171
174
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
172
175
|
|
|
173
176
|
/**
|
|
@@ -175,18 +178,20 @@ export interface FastifyInstance<
|
|
|
175
178
|
*/
|
|
176
179
|
addHook<
|
|
177
180
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
178
|
-
ContextConfig = ContextConfigDefault
|
|
181
|
+
ContextConfig = ContextConfigDefault,
|
|
182
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
179
183
|
>(
|
|
180
184
|
name: 'preHandler',
|
|
181
|
-
hook: preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
185
|
+
hook: preHandlerHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
182
186
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
183
187
|
|
|
184
188
|
addHook<
|
|
185
189
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
186
|
-
ContextConfig = ContextConfigDefault
|
|
190
|
+
ContextConfig = ContextConfigDefault,
|
|
191
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
187
192
|
>(
|
|
188
193
|
name: 'preHandler',
|
|
189
|
-
hook: preHandlerAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
194
|
+
hook: preHandlerAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
190
195
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
191
196
|
|
|
192
197
|
/**
|
|
@@ -196,19 +201,21 @@ export interface FastifyInstance<
|
|
|
196
201
|
addHook<
|
|
197
202
|
PreSerializationPayload = unknown,
|
|
198
203
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
199
|
-
ContextConfig = ContextConfigDefault
|
|
204
|
+
ContextConfig = ContextConfigDefault,
|
|
205
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
200
206
|
>(
|
|
201
207
|
name: 'preSerialization',
|
|
202
|
-
hook: preSerializationHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
208
|
+
hook: preSerializationHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
203
209
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
204
210
|
|
|
205
211
|
addHook<
|
|
206
212
|
PreSerializationPayload = unknown,
|
|
207
213
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
208
|
-
ContextConfig = ContextConfigDefault
|
|
214
|
+
ContextConfig = ContextConfigDefault,
|
|
215
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
209
216
|
>(
|
|
210
217
|
name: 'preSerialization',
|
|
211
|
-
hook: preSerializationAsyncHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
218
|
+
hook: preSerializationAsyncHookHandler<PreSerializationPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
212
219
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
213
220
|
|
|
214
221
|
/**
|
|
@@ -218,19 +225,21 @@ export interface FastifyInstance<
|
|
|
218
225
|
addHook<
|
|
219
226
|
OnSendPayload = unknown,
|
|
220
227
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
221
|
-
ContextConfig = ContextConfigDefault
|
|
228
|
+
ContextConfig = ContextConfigDefault,
|
|
229
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
222
230
|
>(
|
|
223
231
|
name: 'onSend',
|
|
224
|
-
hook: onSendHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
232
|
+
hook: onSendHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
225
233
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
226
234
|
|
|
227
235
|
addHook<
|
|
228
236
|
OnSendPayload = unknown,
|
|
229
237
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
230
|
-
ContextConfig = ContextConfigDefault
|
|
238
|
+
ContextConfig = ContextConfigDefault,
|
|
239
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
231
240
|
>(
|
|
232
241
|
name: 'onSend',
|
|
233
|
-
hook: onSendAsyncHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
242
|
+
hook: onSendAsyncHookHandler<OnSendPayload, RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
234
243
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
235
244
|
|
|
236
245
|
/**
|
|
@@ -239,18 +248,20 @@ export interface FastifyInstance<
|
|
|
239
248
|
*/
|
|
240
249
|
addHook<
|
|
241
250
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
242
|
-
ContextConfig = ContextConfigDefault
|
|
251
|
+
ContextConfig = ContextConfigDefault,
|
|
252
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
|
|
243
253
|
>(
|
|
244
254
|
name: 'onResponse',
|
|
245
|
-
hook: onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
255
|
+
hook: onResponseHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
246
256
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
247
257
|
|
|
248
258
|
addHook<
|
|
249
259
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
250
|
-
ContextConfig = ContextConfigDefault
|
|
260
|
+
ContextConfig = ContextConfigDefault,
|
|
261
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
|
|
251
262
|
>(
|
|
252
263
|
name: 'onResponse',
|
|
253
|
-
hook: onResponseAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
264
|
+
hook: onResponseAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
254
265
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
255
266
|
|
|
256
267
|
/**
|
|
@@ -259,18 +270,20 @@ export interface FastifyInstance<
|
|
|
259
270
|
*/
|
|
260
271
|
addHook<
|
|
261
272
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
262
|
-
ContextConfig = ContextConfigDefault
|
|
273
|
+
ContextConfig = ContextConfigDefault,
|
|
274
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
|
|
263
275
|
>(
|
|
264
276
|
name: 'onTimeout',
|
|
265
|
-
hook: onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
277
|
+
hook: onTimeoutHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
266
278
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
267
279
|
|
|
268
280
|
addHook<
|
|
269
281
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
270
|
-
ContextConfig = ContextConfigDefault
|
|
282
|
+
ContextConfig = ContextConfigDefault,
|
|
283
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
|
|
271
284
|
>(
|
|
272
285
|
name: 'onTimeout',
|
|
273
|
-
hook: onTimeoutAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
286
|
+
hook: onTimeoutAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
274
287
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
275
288
|
|
|
276
289
|
/**
|
|
@@ -281,18 +294,20 @@ export interface FastifyInstance<
|
|
|
281
294
|
*/
|
|
282
295
|
addHook<
|
|
283
296
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
284
|
-
ContextConfig = ContextConfigDefault
|
|
297
|
+
ContextConfig = ContextConfigDefault,
|
|
298
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
|
|
285
299
|
>(
|
|
286
300
|
name: 'onError',
|
|
287
|
-
hook: onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
301
|
+
hook: onErrorHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, FastifyError, Logger>
|
|
288
302
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
289
303
|
|
|
290
304
|
addHook<
|
|
291
305
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
292
|
-
ContextConfig = ContextConfigDefault
|
|
306
|
+
ContextConfig = ContextConfigDefault,
|
|
307
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
|
|
293
308
|
>(
|
|
294
309
|
name: 'onError',
|
|
295
|
-
hook: onErrorAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
310
|
+
hook: onErrorAsyncHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, FastifyError, Logger>
|
|
296
311
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
297
312
|
|
|
298
313
|
// Application addHooks
|
|
@@ -302,10 +317,11 @@ export interface FastifyInstance<
|
|
|
302
317
|
*/
|
|
303
318
|
addHook<
|
|
304
319
|
RouteGeneric extends RouteGenericInterface = RouteGenericInterface,
|
|
305
|
-
ContextConfig = ContextConfigDefault
|
|
320
|
+
ContextConfig = ContextConfigDefault,
|
|
321
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance,
|
|
306
322
|
>(
|
|
307
323
|
name: 'onRoute',
|
|
308
|
-
hook: onRouteHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig>
|
|
324
|
+
hook: onRouteHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ContextConfig, Logger>
|
|
309
325
|
): FastifyInstance<RawServer, RawRequest, RawReply, Logger>;
|
|
310
326
|
|
|
311
327
|
/**
|
package/types/request.d.ts
CHANGED
|
@@ -20,13 +20,14 @@ export interface FastifyRequest<
|
|
|
20
20
|
RawServer extends RawServerBase = RawServerDefault,
|
|
21
21
|
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
|
|
22
22
|
ContextConfig = ContextConfigDefault,
|
|
23
|
+
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
|
23
24
|
> {
|
|
24
25
|
id: any;
|
|
25
26
|
params: RouteGeneric['Params'];
|
|
26
27
|
raw: RawRequest;
|
|
27
28
|
query: RouteGeneric['Querystring'];
|
|
28
29
|
headers: RawRequest['headers'] & RouteGeneric['Headers']; // this enables the developer to extend the existing http(s|2) headers list
|
|
29
|
-
log:
|
|
30
|
+
log: Logger;
|
|
30
31
|
server: FastifyInstance;
|
|
31
32
|
body: RouteGeneric['Body'];
|
|
32
33
|
context: FastifyContext<ContextConfig>;
|