@fastify/middie
Advanced tools
Comparing version 8.1.0 to 8.2.0
@@ -36,2 +36,3 @@ 'use strict' | ||
req.raw.hostname = req.hostname | ||
req.raw.protocol = req.protocol | ||
req.raw.ip = req.ip | ||
@@ -38,0 +39,0 @@ req.raw.ips = req.ips |
{ | ||
"name": "@fastify/middie", | ||
"version": "8.1.0", | ||
"version": "8.2.0", | ||
"description": "Middleware engine for Fastify", | ||
@@ -48,3 +48,3 @@ "main": "index.js", | ||
"tap": "^16.0.0", | ||
"tsd": "^0.25.0" | ||
"tsd": "^0.28.0" | ||
}, | ||
@@ -51,0 +51,0 @@ "dependencies": { |
@@ -10,9 +10,10 @@ 'use strict' | ||
test('Should enhance the Node.js core request/response objects', t => { | ||
t.plan(13) | ||
test('Should enhance the Node.js core request/response objects', (t) => { | ||
t.plan(14) | ||
const fastify = Fastify() | ||
t.teardown(fastify.close) | ||
fastify.register(middiePlugin, { hook: 'preHandler' }) | ||
.after(() => { fastify.use(cors()) }) | ||
fastify.register(middiePlugin, { hook: 'preHandler' }).after(() => { | ||
fastify.use(cors()) | ||
}) | ||
@@ -23,2 +24,3 @@ fastify.post('/', async (req, reply) => { | ||
t.equal(req.raw.hostname, req.hostname) | ||
t.equal(req.raw.protocol, req.protocol) | ||
t.equal(req.raw.ip, req.ip) | ||
@@ -37,14 +39,17 @@ t.same(req.raw.ips, req.ips) | ||
t.error(err) | ||
sget({ | ||
method: 'POST', | ||
url: `${address}?foo=bar`, | ||
body: { bar: 'foo' }, | ||
json: true | ||
}, (err, res, data) => { | ||
t.error(err) | ||
}) | ||
sget( | ||
{ | ||
method: 'POST', | ||
url: `${address}?foo=bar`, | ||
body: { bar: 'foo' }, | ||
json: true | ||
}, | ||
(err, res, data) => { | ||
t.error(err) | ||
} | ||
) | ||
}) | ||
}) | ||
test('Should not enhance the Node.js core request/response objects when there are no middlewares', t => { | ||
test('Should not enhance the Node.js core request/response objects when there are no middlewares', (t) => { | ||
t.plan(11) | ||
@@ -71,11 +76,14 @@ const fastify = Fastify() | ||
t.error(err) | ||
sget({ | ||
method: 'POST', | ||
url: `${address}?foo=bar`, | ||
body: { bar: 'foo' }, | ||
json: true | ||
}, (err, res, data) => { | ||
t.error(err) | ||
}) | ||
sget( | ||
{ | ||
method: 'POST', | ||
url: `${address}?foo=bar`, | ||
body: { bar: 'foo' }, | ||
json: true | ||
}, | ||
(err, res, data) => { | ||
t.error(err) | ||
} | ||
) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
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
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
62151
1948
1