@@ -34,7 +34,8 @@ are Request/Reply hooks and application hooks:
3434- [ Using Hooks to Inject Custom Properties] ( #using-hooks-to-inject-custom-properties )
3535- [ Diagnostics Channel Hooks] ( #diagnostics-channel-hooks )
3636
37- > ℹ️ Note: The ` done ` callback is not available when using ` async ` /` await ` or
37+ > ℹ️ Note:
38+ > The ` done ` callback is not available when using ` async ` /` await ` or
3839> returning a ` Promise ` . If you do invoke a ` done ` callback in this situation
3940> unexpected behavior may occur, e.g. duplicate invocation of handlers.
4041
@@ -68,7 +69,8 @@ fastify.addHook('onRequest', async (request, reply) => {
6869})
6970```
7071
71- > ℹ️ Note: In the [ onRequest] ( #onrequest ) hook, ` request.body ` will always be
72+ > ℹ️ Note:
73+ > In the [ onRequest] ( #onrequest ) hook, ` request.body ` will always be
7274> ` undefined ` , because the body parsing happens before the
7375> [ preValidation] ( #prevalidation ) hook.
7476
@@ -98,16 +100,19 @@ fastify.addHook('preParsing', async (request, reply, payload) => {
98100})
99101```
100102
101- > ℹ️ Note: In the [ preParsing] ( #preparsing ) hook, ` request.body ` will always be
103+ > ℹ️ Note:
104+ > In the [ preParsing] ( #preparsing ) hook, ` request.body ` will always be
102105> ` undefined ` , because the body parsing happens before the
103106> [ preValidation] ( #prevalidation ) hook.
104107
105- > ℹ️ Note: You should also add a ` receivedEncodedLength ` property to the
108+ > ℹ️ Note:
109+ > You should also add a ` receivedEncodedLength ` property to the
106110> returned stream. This property is used to correctly match the request payload
107111> with the ` Content-Length ` header value. Ideally, this property should be updated
108112> on each received chunk.
109113
110- > ℹ️ Note: The size of the returned stream is checked to not exceed the limit
114+ > ℹ️ Note:
115+ > The size of the returned stream is checked to not exceed the limit
111116> set in [ ` bodyLimit ` ] ( ./Server.md#bodylimit ) option.
112117
113118### preValidation
@@ -166,7 +171,8 @@ fastify.addHook('preSerialization', async (request, reply, payload) => {
166171})
167172```
168173
169- > ℹ️ Note: The hook is NOT called if the payload is a ` string ` , a ` Buffer ` , a
174+ > ℹ️ Note:
175+ > The hook is NOT called if the payload is a ` string ` , a ` Buffer ` , a
170176> ` stream ` , or ` null ` .
171177
172178### onError
@@ -192,7 +198,8 @@ an exception.
192198This hook will be executed before
193199the [ Custom Error Handler set by ` setErrorHandler ` ] ( ./Server.md#seterrorhandler ) .
194200
195- > ℹ️ Note: Unlike the other hooks, passing an error to the ` done ` function is not
201+ > ℹ️ Note:
202+ > Unlike the other hooks, passing an error to the ` done ` function is not
196203> supported.
197204
198205### onSend
@@ -229,7 +236,8 @@ fastify.addHook('onSend', (request, reply, payload, done) => {
229236> to ` 0 ` , whereas the ` Content-Length ` header will not be set if the payload is
230237> ` null ` .
231238
232- > ℹ️ Note: If you change the payload, you may only change it to a ` string ` , a
239+ > ℹ️ Note:
240+ > If you change the payload, you may only change it to a ` string ` , a
233241> ` Buffer ` , a ` stream ` , a ` ReadableStream ` , a ` Response ` , or ` null ` .
234242
235243
@@ -252,7 +260,8 @@ The `onResponse` hook is executed when a response has been sent, so you will not
252260be able to send more data to the client. It can however be useful for sending
253261data to external services, for example, to gather statistics.
254262
255- > ℹ️ Note: Setting ` disableRequestLogging ` to ` true ` will disable any error log
263+ > ℹ️ Note:
264+ > Setting ` disableRequestLogging ` to ` true ` will disable any error log
256265> inside the ` onResponse ` hook. In this case use ` try - catch ` to log errors.
257266
258267### onTimeout
@@ -294,7 +303,8 @@ The `onRequestAbort` hook is executed when a client closes the connection before
294303the entire request has been processed. Therefore, you will not be able to send
295304data to the client.
296305
297- > ℹ️ Note: Client abort detection is not completely reliable.
306+ > ℹ️ Note:
307+ > Client abort detection is not completely reliable.
298308> See: [ ` Detecting-When-Clients-Abort.md ` ] ( ../Guides/Detecting-When-Clients-Abort.md )
299309
300310### Manage Errors from a hook
@@ -448,8 +458,9 @@ fastify.addHook('onListen', async function () {
448458})
449459```
450460
451- > ℹ️ Note: This hook will not run when the server is started using
452- > fastify.inject()` or ` fastify.ready()`.
461+ > ℹ️ Note:
462+ > This hook will not run when the server is started using
463+ > ` fastify.inject() ` or ` fastify.ready() ` .
453464
454465### onClose
455466<a id =" on-close " ></a >
@@ -572,7 +583,8 @@ This hook can be useful if you are developing a plugin that needs to know when a
572583plugin context is formed, and you want to operate in that specific context, thus
573584this hook is encapsulated.
574585
575- > ℹ️ Note: This hook will not be called if a plugin is wrapped inside
586+ > ℹ️ Note:
587+ > This hook will not be called if a plugin is wrapped inside
576588> [ ` fastify-plugin ` ] ( https://github.com/fastify/fastify-plugin ) .
577589``` js
578590fastify .decorate (' data' , [])
@@ -770,7 +782,8 @@ fastify.route({
770782})
771783```
772784
773- > ℹ️ Note: Both options also accept an array of functions.
785+ > ℹ️ Note:
786+ > Both options also accept an array of functions.
774787
775788## Using Hooks to Inject Custom Properties
776789<a id =" using-hooks-to-inject-custom-properties " ></a >
@@ -857,7 +870,8 @@ channel.subscribe(function ({ fastify }) {
857870})
858871` ` `
859872
860- > ℹ️ Note: The TracingChannel class API is currently experimental and may undergo
873+ > ℹ️ Note:
874+ > The TracingChannel class API is currently experimental and may undergo
861875> breaking changes even in semver-patch releases of Node.js.
862876
863877Five other events are published on a per-request basis following the
0 commit comments