Skip to content

Type Alias: FastifyJSONEnvelopeOptions ​

FastifyJSONEnvelopeOptions = object

The options of fastifyJSONEnvelope.

Properties ​

actionErrorStatus? ​

optional actionErrorStatus?: 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? ​

optional errorStatus?: 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? ​

optional extra?: (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 ​

ts
no extra field

Released under the MIT License.