Skip to content

Commit af3da29

Browse files
authored
fix: correct brotli options format (#165)
* fix: correct brotli options format 3d205cd didn't actually fix the default compression issue described in #121 because the zlib format expects quality to be inside [an option called `params`](https://nodejs.org/api/zlib.html#class-brotlioptions) * tests: update defaults test * chore: remove trailing whitespace
1 parent 41af9e8 commit af3da29

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

__tests__/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ test('default brotli param quality should be 4', () => {
88
const middleware = createCompressMiddleware()
99
assert(Array.isArray(middleware.preferredEncodings))
1010
assert(middleware.encodingOptions)
11-
assert.strictEqual(middleware.encodingOptions.br[zlib.constants.BROTLI_PARAM_QUALITY], 4)
11+
assert.strictEqual(middleware.encodingOptions.br.params[zlib.constants.BROTLI_PARAM_QUALITY], 4)
1212
})

lib/encodings.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ Encodings.encodingMethodDefaultOptions = {
8989
gzip: {},
9090
deflate: {},
9191
br: {
92-
[zlib.constants.BROTLI_PARAM_QUALITY]: 4
92+
params: {
93+
[zlib.constants.BROTLI_PARAM_QUALITY]: 4
94+
}
9395
}
9496
}
9597

0 commit comments

Comments
 (0)