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

fastify-compress

Package Overview
Dependencies
Maintainers
10
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-compress - npm Package Compare versions

Comparing version 3.4.0 to 3.4.1

.github/dependabot.yml

12

index.js

@@ -22,2 +22,4 @@ 'use strict'

const compressAdded = Symbol('fastify-compress.added')
function compressPlugin (fastify, opts, next) {

@@ -183,2 +185,12 @@ const globalCompressParams = processCompressParams(opts)

function buildRouteCompress (fastify, params, routeOptions, decorateOnly) {
// This methods works by altering the routeOptions, it has side effects.
// There is the possibility that the same options are set for more than
// one route, so we just need to make sure that the hook is addded only
// once.
if (routeOptions[compressAdded]) {
return
}
routeOptions[compressAdded] = true
// In order to provide a compress method with the same parameter set as the route itself has

@@ -185,0 +197,0 @@ // we do the decorate the reply at the start of the request

4

package.json
{
"name": "fastify-compress",
"version": "3.4.0",
"version": "3.4.1",
"description": "Fastify compression utils",

@@ -31,3 +31,3 @@ "main": "index.js",

"tap": "^14.10.8",
"tsd": "^0.13.1",
"tsd": "^0.14.0",
"typescript": "^4.0.2"

@@ -34,0 +34,0 @@ },

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

})
test('avoid double onSend', t => {
t.plan(2)
const server = Fastify()
server.register(compressPlugin, {
threshold: 0
})
server.register(async function (server) {
server.get('/', async (req, _) => {
return { hi: true }
})
}, { prefix: '/test' })
server.inject({
url: '/test',
method: 'GET',
headers: {
'accept-encoding': 'br'
}
}, (err, res) => {
t.error(err)
t.deepEqual(JSON.parse(zlib.brotliDecompressSync(res.rawPayload)), { hi: true })
})
})

Sorry, the diff of this file is not supported yet

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