fastify 5.3.0 → 5.3.1
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/.vscode/settings.json +22 -0
- package/fastify.js +1 -1
- package/lib/validation.js +11 -1
- package/package.json +1 -1
- package/test/custom-parser.0.test.js +160 -129
- package/test/custom-parser.1.test.js +77 -63
- package/test/custom-querystring-parser.test.js +46 -28
- package/test/logger/instantiation.test.js +89 -96
- package/test/logger/logging.test.js +116 -120
- package/test/logger/options.test.js +97 -99
- package/test/logger/request.test.js +66 -66
- package/test/schema-validation.test.js +120 -0
- package/test/stream.4.test.js +38 -33
- package/test/toolkit.js +31 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"workbench.colorCustomizations": {
|
|
3
|
+
"[GitHub Dark]": {
|
|
4
|
+
"tab.activeBackground": "#0d0d0d",
|
|
5
|
+
"tab.activeBorder": "#ffff00"
|
|
6
|
+
},
|
|
7
|
+
"activityBar.background": "#FBE7B2",
|
|
8
|
+
"activityBar.foreground": "#52358C",
|
|
9
|
+
"activityBar.inactiveForeground": "#616161",
|
|
10
|
+
"activityBar.activeBorder": "#04184d",
|
|
11
|
+
"activityBar.activeBackground": "#C3B48B",
|
|
12
|
+
"activityBar.border": "#C3B48B",
|
|
13
|
+
"titleBar.activeBackground": "#D2BE88",
|
|
14
|
+
"titleBar.activeForeground": "#52358C",
|
|
15
|
+
"titleBar.inactiveBackground": "#bdb59c",
|
|
16
|
+
"titleBar.inactiveForeground": "#616161",
|
|
17
|
+
"titleBar.border": "#C3B48B",
|
|
18
|
+
"statusBar.background": "#E9DBB7",
|
|
19
|
+
"statusBar.foreground": "#52358C",
|
|
20
|
+
"statusBar.border": "#C3B48B"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/fastify.js
CHANGED
package/lib/validation.js
CHANGED
|
@@ -155,7 +155,7 @@ function validate (context, request, execution) {
|
|
|
155
155
|
validatorFunction = context[bodySchema]
|
|
156
156
|
} else if (context[bodySchema]) {
|
|
157
157
|
// TODO: add request.contentType and reuse it here
|
|
158
|
-
const contentType = request.headers['content-type']
|
|
158
|
+
const contentType = getEssenceMediaType(request.headers['content-type'])
|
|
159
159
|
const contentSchema = context[bodySchema][contentType]
|
|
160
160
|
if (contentSchema) {
|
|
161
161
|
validatorFunction = contentSchema
|
|
@@ -254,6 +254,16 @@ function wrapValidationError (result, dataVar, schemaErrorFormatter) {
|
|
|
254
254
|
return error
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
+
/**
|
|
258
|
+
* simple function to retrieve the essence media type
|
|
259
|
+
* @param {string} header
|
|
260
|
+
* @returns {string} Mimetype string.
|
|
261
|
+
*/
|
|
262
|
+
function getEssenceMediaType (header) {
|
|
263
|
+
if (!header) return ''
|
|
264
|
+
return header.split(';', 1)[0].trim().toLowerCase()
|
|
265
|
+
}
|
|
266
|
+
|
|
257
267
|
module.exports = {
|
|
258
268
|
symbols: { bodySchema, querystringSchema, responseSchema, paramsSchema, headersSchema },
|
|
259
269
|
compileSchemasForValidation,
|