fastify 5.3.0 → 5.3.2

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.
@@ -12,7 +12,7 @@ The modules we will use:
12
12
  tool written in node.
13
13
  - [Branch-comparer](https://github.com/StarpTech/branch-comparer): Checkout
14
14
  multiple git branches, execute scripts, and log the results.
15
- - [Concurrently](https://github.com/kimmobrunfeldt/concurrently): Run commands
15
+ - [Concurrently](https://github.com/open-cli-tools/concurrently): Run commands
16
16
  concurrently.
17
17
  - [Npx](https://github.com/npm/npx): NPM package runner used to run scripts
18
18
  against different Node.js Versions and execute local binaries. Shipped with
package/fastify.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- const VERSION = '5.3.0'
3
+ const VERSION = '5.3.2'
4
4
 
5
5
  const Avvio = require('avvio')
6
6
  const http = require('node:http')
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']?.split(';', 1)[0]
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify",
3
- "version": "5.3.0",
3
+ "version": "5.3.2",
4
4
  "description": "Fast and low overhead web framework, for Node.js",
5
5
  "main": "fastify.js",
6
6
  "type": "commonjs",