Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fastify/middie

Package Overview
Dependencies
Maintainers
20
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/middie - npm Package Compare versions

Comparing version 8.3.0 to 8.3.1

.gitattributes

2

index.js

@@ -70,5 +70,5 @@ 'use strict'

req.raw.log = req.log
req.raw.body = req.body
req.raw.query = req.query
reply.raw.log = req.log
if (req.body !== undefined) req.raw.body = req.body
this[kMiddie].run(req.raw, reply.raw, next)

@@ -75,0 +75,0 @@ } else {

{
"name": "@fastify/middie",
"version": "8.3.0",
"version": "8.3.1",
"description": "Middleware engine for Fastify",
"main": "index.js",
"type": "commonjs",
"types": "types/index.d.ts",

@@ -48,3 +49,3 @@ "scripts": {

"tap": "^16.0.0",
"tsd": "^0.28.0"
"tsd": "^0.31.0"
},

@@ -51,0 +52,0 @@ "dependencies": {

@@ -71,3 +71,3 @@ # @fastify/middie

__Every registered middleware will be run during the `onRequest` hook phase__, so the registration order is important.
Take a look at the [Lifecycle](https://www.fastify.io/docs/latest/Reference/Lifecycle/) documentation page to understand better how every request is executed.
Take a look at the [Lifecycle](https://fastify.dev/docs/latest/Reference/Lifecycle/) documentation page to understand better how every request is executed.

@@ -110,3 +110,3 @@ ```js

*Note you can access `req.body` from the `preParsing`, `onError`, `preSerialization` and `onSend` lifecycle steps. Take a look at the [Lifecycle](https://www.fastify.io/docs/latest/Reference/Lifecycle/) documentation page to see the order of the steps.*
*Note you can access `req.body` from the `preParsing`, `onError`, `preSerialization` and `onSend` lifecycle steps. Take a look at the [Lifecycle](https://www.fastify.dev/docs/latest/Reference/Lifecycle/) documentation page to see the order of the steps.*

@@ -146,3 +146,3 @@ ```js

const fastify = require('fastify')()
const path = require('path')
const path = require('node:path')
const serveStatic = require('serve-static')

@@ -166,2 +166,8 @@

#### :warning: potential ReDoS attacks
Middie use [`path-to-regexp`](http://npm.im/path-to-regexp) to convert paths to regular expressions.
This might cause potential [ReDoS](https://en.wikipedia.org/wiki/ReDoS) attacks in your applications if
certain patterns are used. Use it with care.
# Middie Engine

@@ -174,3 +180,3 @@

const Middie = require('@fastify/middie/engine')
const http = require('http')
const http = require('node:http')
const helmet = require('helmet')

@@ -177,0 +183,0 @@ const cors = require('cors')

@@ -5,4 +5,4 @@ 'use strict'

const t = require('tap')
const http = require('http')
const { join } = require('path')
const http = require('node:http')
const { join } = require('node:path')
const serveStatic = require('serve-static')

@@ -9,0 +9,0 @@ const test = t.test

@@ -86,1 +86,28 @@ 'use strict'

})
test('If the enhanced response body is undefined, the body key should not exist', (t) => {
t.plan(3)
const fastify = Fastify()
t.teardown(fastify.close)
fastify.register(middiePlugin).after(() => {
fastify.use(cors())
fastify.use((req, res, next) => {
t.equal('body' in req, false)
next()
})
})
fastify.listen({ port: 0 }, (err, address) => {
t.error(err)
sget(
{
method: 'POST',
url: `${address}?foo=bar`
},
(err, res, data) => {
t.error(err)
}
)
})
})

@@ -12,3 +12,3 @@ 'use strict'

const helmet = require('helmet')
const fs = require('fs')
const fs = require('node:fs')

@@ -15,0 +15,0 @@ const middiePlugin = require('../index')

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc