Type Alias: FastifyJSONEnvelopeOptions
FastifyJSONEnvelopeOptions =
object
The options of fastifyJSONEnvelope.
Properties
actionErrorStatus?
optionalactionErrorStatus?:number
The HTTP status of the errors of the actions only (their dispatch failed: validation, access control, their own exceptions), over errorStatus; the errors of the hooks (an authenticator's 401), of fastify and the routes not found keep theirs. 200 answers as the applications of lakutata 2.x usually did.
Default
errorStatus
errorStatus?
optionalerrorStatus?:number
The HTTP status of every error response, such as 200 for the clients that read the errors from the envelope.
Default
the error's own status (see statusOfError)
extra?
optionalextra?: (request) =>Record<string,unknown>
The extra fields of the envelope, such as the timestamp, nonce or requestId of the envelopes of the applications of lakutata 2.x: called for each response (a result or an error), its fields added after errno, errMsg and data, which they never replace. When it throws, a result is answered as an error, and an error without the extra fields.
Parameters
request
FastifyRequest
The fastify request being answered.
Returns
Record<string, unknown>
The fields to add to the envelope.
Default
no extra field