koa-compress 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/HISTORY.md CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ 4.0.1 / 2020-04-29
3
+ ==================
4
+
5
+ * fix issue with state being preserved between requests
6
+
2
7
  4.0.0 / 2020-04-27
3
8
  ==================
4
9
 
@@ -8,6 +13,7 @@
8
13
  * added compression disabling option: set `options.br = false`
9
14
 
10
15
  3.1.0 / 2020-04-15
16
+ ==================
11
17
 
12
18
  * support no-transform @Pawda
13
19
 
package/lib/index.js CHANGED
@@ -31,9 +31,6 @@ module.exports = (options = {}) => {
31
31
 
32
32
  // `options.br = false` would remove it as a preferred encoding
33
33
  const preferredEncodings = Encodings.preferredEncodings.filter((encoding) => options[encoding] !== false && options[encoding] !== null)
34
- const encodings = new Encodings({
35
- preferredEncodings
36
- })
37
34
 
38
35
  return async (ctx, next) => {
39
36
  ctx.vary('Accept-Encoding')
@@ -61,6 +58,9 @@ module.exports = (options = {}) => {
61
58
  if (threshold && ctx.response.length < threshold) return
62
59
 
63
60
  // get the preferred content encoding
61
+ const encodings = new Encodings({
62
+ preferredEncodings
63
+ })
64
64
  encodings.parseAcceptEncoding(ctx.request.headers['accept-encoding'] || undefined)
65
65
  const encoding = encodings.getPreferredContentEncoding()
66
66
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koa-compress",
3
3
  "description": "Compress middleware for koa",
4
- "version": "4.0.0",
4
+ "version": "4.0.1",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
7
7
  "email": "me@jongleberry.com",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "scripts": {
32
32
  "eslint": "eslint --ignore-path .gitignore .",
33
- "test": "jest --forceExit"
33
+ "test": "jest"
34
34
  },
35
35
  "files": [
36
36
  "lib",