koa-compress 5.2.1 → 5.2.2

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.
Files changed (2) hide show
  1. package/lib/index.js +5 -1
  2. package/package.json +6 -6
package/lib/index.js CHANGED
@@ -101,7 +101,11 @@ module.exports = (options = {}) => {
101
101
  !ctx.writable ||
102
102
  ctx.compress === false ||
103
103
  ctx.request.method === 'HEAD' ||
104
- emptyBodyStatuses.has(+ctx.response.status) ||
104
+ emptyBodyStatuses.has(ctx.status) ||
105
+ // don't compress partial content: Content-Range describes unencoded byte offsets
106
+ ctx.status === 206 ||
107
+ ctx.response.get('Content-Range') ||
108
+ /^multipart\/byteranges\b/i.test(ctx.response.get('Content-Type') || '') ||
105
109
  ctx.response.get('Content-Encoding') ||
106
110
  // forced compression or implied
107
111
  !(ctx.compress === true || filter(type)) ||
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koa-compress",
3
3
  "description": "Compress middleware for koa",
4
- "version": "5.2.1",
4
+ "version": "5.2.2",
5
5
  "type": "commonjs",
6
6
  "author": {
7
7
  "name": "Jonathan Ong",
@@ -31,15 +31,15 @@
31
31
  "negotiator": "^1.0.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/koa": "^3.0.1",
35
- "@types/node": "^25.5.0",
34
+ "@types/koa": "^3.0.3",
35
+ "@types/node": "^25.9.3",
36
36
  "c8": "^11.0.0",
37
- "jest": "^30.3.0",
38
- "koa": "^3.1.2",
37
+ "jest": "^30.4.2",
38
+ "koa": "^3.2.1",
39
39
  "snazzy": "^9.0.0",
40
40
  "standard": "^17.1.2",
41
41
  "supertest": "^7.2.2",
42
- "typescript": "^5.9.3"
42
+ "typescript": "^6.0.3"
43
43
  },
44
44
  "scripts": {
45
45
  "test": "jest",