@fastify/middie
Advanced tools
Comparing version 8.3.0 to 8.3.1
@@ -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') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
67298
19
2103
269
0
1
352583
2