fastify
Version:
Fast and low overhead web framework, for Node.js
103 lines (89 loc) • 3.9 kB
JavaScript
'use strict'
const { createWarning } = require('process-warning')
/**
* Warning codes:
* - FSTWRN001
* - FSTSEC001
* - FSTSEC002
* - FSTSEC003
* - FSTDEP022
* - FSTDEP023
* - FSTDEP024
* - FSTDEP025
*
* Deprecation Codes FSTDEP001 - FSTDEP021 were used by v4 and MUST NOT be reused.
* - FSTDEP022 - FSTDEP025 are used by v5 and MUST NOT be reused.
* Warning Codes FSTWRN001 - FSTWRN002 were used by v4 and MUST NOT be reused.
*/
const FSTWRN001 = createWarning({
name: 'FastifyWarning',
code: 'FSTWRN001',
message: 'The %s schema for %s: %s is missing. This may indicate the schema is not well specified.',
unlimited: true
})
const FSTWRN003 = createWarning({
name: 'FastifyWarning',
code: 'FSTWRN003',
message: 'The %s mixes async and callback styles that may lead to unhandled rejections. Please use only one of them.',
unlimited: true
})
const FSTWRN004 = createWarning({
name: 'FastifyWarning',
code: 'FSTWRN004',
message: 'It seems that you are overriding an errorHandler in the same scope, which can lead to subtle bugs. To disable this behavior, set \'allowErrorHandlerOverride\' to false. For more information, visit: https://fastify.dev/docs/latest/Reference/Server/#allowerrorhandleroverride',
unlimited: true
})
const FSTSEC001 = createWarning({
name: 'FastifySecurity',
code: 'FSTSEC001',
message: 'You are using /%s/ Content-Type which may be vulnerable to CORS attack. Please make sure your RegExp start with "^" or include ";?" to proper detection of the essence MIME type.',
unlimited: true
})
const FSTSEC002 = createWarning({
name: 'FastifySecurity',
code: 'FSTSEC002',
message: 'The headers schema for %s: %s references an external $ref (%s) that is not case-normalized. Header names in the referenced schema keep their original case and will not match the lowercased request headers, so case-insensitive assertions such as required and dependencies may not apply. Inline the header schema instead of referencing it with an external $ref.',
unlimited: true
})
const FSTSEC003 = createWarning({
name: 'FastifySecurity',
code: 'FSTSEC003',
message: 'The headers schema for %s: %s uses a $ref (%s) inside propertyNames that is not case-normalized. Header names held in the referenced schema keep their original case and will not match the lowercased request headers, so a case-insensitive deny-list or allow-list on header names may not apply. Inline the propertyNames constraint instead of referencing it with a $ref.',
unlimited: true
})
const FSTDEP022 = createWarning({
name: 'FastifyWarning',
code: 'FSTDEP022',
message: 'The router options for %s property access is deprecated. Please use "options.routerOptions" instead for accessing router options. The router options will be removed in `fastify@6`.',
unlimited: true
})
const FSTDEP023 = createWarning({
name: 'FastifyDeprecation',
code: 'FSTDEP023',
message: 'disableRequestLogging option is deprecated. Use the logController option with disableRequestLogging or isLogDisabled override instead. The disableRequestLogging top-level option will be removed in `fastify@6`.',
unlimited: true
})
const FSTDEP024 = createWarning({
name: 'FastifyDeprecation',
code: 'FSTDEP024',
message: 'requestIdLogLabel option is deprecated. Use the logController option with requestIdLogLabel instead. The requestIdLogLabel top-level option will be removed in `fastify@6`.',
unlimited: true
})
const FSTDEP025 = createWarning({
name: 'FastifyDeprecation',
code: 'FSTDEP025',
message: 'Calling addHttpMethod for existing method "%s" without { overrideExisting: true } is deprecated. In Fastify v6, this will throw an error.',
unlimited: true
})
module.exports = {
FSTWRN001,
FSTWRN003,
FSTWRN004,
FSTSEC001,
FSTSEC002,
FSTSEC003,
FSTDEP022,
FSTDEP023,
FSTDEP024,
FSTDEP025
}