@fastify/compress
Advanced tools
Comparing version 7.0.0 to 7.0.1
18
index.js
@@ -112,2 +112,9 @@ 'use strict' | ||
const defaultCompressibleTypes = /^text\/(?!event-stream)|(?:\+|\/)json(?:;|$)|(?:\+|\/)text(?:;|$)|(?:\+|\/)xml(?:;|$)|octet-stream(?:;|$)/u | ||
const recommendedDefaultBrotliOptions = { | ||
params: { | ||
// Default of 4 as 11 has a heavy impact on performance. | ||
// https://blog.cloudflare.com/this-is-brotli-from-origin#testing | ||
[zlib.constants.BROTLI_PARAM_QUALITY]: 4 | ||
} | ||
} | ||
@@ -121,12 +128,9 @@ function processCompressParams (opts) { | ||
const params = { | ||
global: (typeof opts.global === 'boolean') ? opts.global : true, | ||
/** | ||
* Default of 4 as 11 has a heavy impact on performance. | ||
* @see {@link https://blog.cloudflare.com/this-is-brotli-from-origin#testing} | ||
*/ | ||
brotliOptions: { [zlib.constants.BROTLI_PARAM_QUALITY]: 4, ...opts.brotliOptions } | ||
global: (typeof opts.global === 'boolean') ? opts.global : true | ||
} | ||
params.removeContentLengthHeader = typeof opts.removeContentLengthHeader === 'boolean' ? opts.removeContentLengthHeader : true | ||
params.brotliOptions = opts.brotliOptions | ||
params.brotliOptions = params.global | ||
? { ...recommendedDefaultBrotliOptions, ...opts.brotliOptions } | ||
: opts.brotliOptions | ||
params.zlibOptions = opts.zlibOptions | ||
@@ -133,0 +137,0 @@ params.onUnsupportedEncoding = opts.onUnsupportedEncoding |
{ | ||
"name": "@fastify/compress", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"description": "Fastify compression utils", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,3 +43,3 @@ import fastify, { FastifyInstance } from 'fastify' | ||
// Instanciation of an app without global | ||
// Instantiation of an app without global | ||
const appWithoutGlobal: FastifyInstance = fastify() | ||
@@ -111,7 +111,7 @@ appWithoutGlobal.register(fastifyCompress, { global: false }) | ||
(err) => { | ||
expectType<Error>(err) | ||
expectType<Error | undefined>(err) | ||
} | ||
) | ||
// Instanciation of an app that should trigger a typescript error | ||
// Instantiation of an app that should trigger a typescript error | ||
const appThatTriggerAnError = fastify() | ||
@@ -118,0 +118,0 @@ expectError(appThatTriggerAnError.register(fastifyCompress, { |
Sorry, the diff of this file is too big to display
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
166963
4424
1