@fastify/compress 8.0.1 → 8.0.3

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.
@@ -18,7 +18,7 @@ describe('When `global` is not set, it is `true` by default :', async () => {
18
18
  await fastify.register(compressPlugin, { threshold: 0 })
19
19
 
20
20
  const buf = Buffer.from('hello world')
21
- fastify.get('/', (request, reply) => {
21
+ fastify.get('/', (_request, reply) => {
22
22
  reply.send(buf)
23
23
  })
24
24
 
@@ -40,7 +40,7 @@ describe('When `global` is not set, it is `true` by default :', async () => {
40
40
  await fastify.register(compressPlugin, { threshold: 0 })
41
41
 
42
42
  const buf = Buffer.from('hello world')
43
- fastify.get('/', (request, reply) => {
43
+ fastify.get('/', (_request, reply) => {
44
44
  reply.send(buf)
45
45
  })
46
46
 
@@ -62,7 +62,7 @@ describe('When `global` is not set, it is `true` by default :', async () => {
62
62
  await fastify.register(compressPlugin, { threshold: 0 })
63
63
 
64
64
  const buf = Buffer.from('hello world')
65
- fastify.get('/', (request, reply) => {
65
+ fastify.get('/', (_request, reply) => {
66
66
  reply.send(buf)
67
67
  })
68
68
 
@@ -85,7 +85,7 @@ describe('When `global` is not set, it is `true` by default :', async () => {
85
85
 
86
86
  const json = { hello: 'world' }
87
87
 
88
- fastify.get('/', (request, reply) => {
88
+ fastify.get('/', (_request, reply) => {
89
89
  reply.send(json)
90
90
  })
91
91
 
@@ -108,7 +108,7 @@ describe('When `global` is not set, it is `true` by default :', async () => {
108
108
 
109
109
  const json = { hello: 'world' }
110
110
 
111
- fastify.get('/', (request, reply) => {
111
+ fastify.get('/', (_request, reply) => {
112
112
  reply.send(json)
113
113
  })
114
114
 
@@ -130,7 +130,7 @@ describe('When `global` is not set, it is `true` by default :', async () => {
130
130
  await fastify.register(compressPlugin, { threshold: 0 })
131
131
 
132
132
  const json = { hello: 'world' }
133
- fastify.get('/', (request, reply) => {
133
+ fastify.get('/', (_request, reply) => {
134
134
  reply.send(json)
135
135
  })
136
136
 
@@ -151,7 +151,7 @@ describe('When `global` is not set, it is `true` by default :', async () => {
151
151
  const fastify = Fastify()
152
152
  await fastify.register(compressPlugin, { threshold: 0 })
153
153
 
154
- fastify.get('/', (request, reply) => {
154
+ fastify.get('/', (_request, reply) => {
155
155
  reply
156
156
  .type('text/plain')
157
157
  .send('hello')
@@ -174,7 +174,7 @@ describe('When `global` is not set, it is `true` by default :', async () => {
174
174
  const fastify = Fastify()
175
175
  await fastify.register(compressPlugin, { threshold: 0 })
176
176
 
177
- fastify.get('/', (request, reply) => {
177
+ fastify.get('/', (_request, reply) => {
178
178
  reply
179
179
  .type('text/plain')
180
180
  .compress('hello')
@@ -197,7 +197,7 @@ describe('When `global` is not set, it is `true` by default :', async () => {
197
197
  const fastify = Fastify()
198
198
  await fastify.register(compressPlugin, { threshold: 0 })
199
199
 
200
- fastify.get('/', (request, reply) => {
200
+ fastify.get('/', (_request, reply) => {
201
201
  reply
202
202
  .type('text/plain')
203
203
  .compress('hello')
@@ -222,7 +222,7 @@ describe('It should send compressed Stream data when `global` is `true` :', asyn
222
222
  const fastify = Fastify()
223
223
  await fastify.register(compressPlugin, { global: true })
224
224
 
225
- fastify.get('/', (request, reply) => {
225
+ fastify.get('/', (_request, reply) => {
226
226
  reply
227
227
  .type('text/plain')
228
228
  .compress(createReadStream('./package.json'))
@@ -248,7 +248,7 @@ describe('It should send compressed Stream data when `global` is `true` :', asyn
248
248
  const fastify = Fastify()
249
249
  await fastify.register(compressPlugin, { global: true })
250
250
 
251
- fastify.get('/', (request, reply) => {
251
+ fastify.get('/', (_request, reply) => {
252
252
  reply
253
253
  .type('text/plain')
254
254
  .compress(createReadStream('./package.json'))
@@ -275,7 +275,7 @@ describe('It should send compressed Stream data when `global` is `true` :', asyn
275
275
  const fastify = Fastify()
276
276
  await fastify.register(compressPlugin, { global: true })
277
277
 
278
- fastify.get('/', (request, reply) => {
278
+ fastify.get('/', (_request, reply) => {
279
279
  reply
280
280
  .type('text/plain')
281
281
  .compress(createReadStream('./package.json'))
@@ -304,7 +304,7 @@ describe('It should send compressed Buffer data when `global` is `true` :', asyn
304
304
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
305
305
 
306
306
  const buf = Buffer.from('hello world')
307
- fastify.get('/', (request, reply) => {
307
+ fastify.get('/', (_request, reply) => {
308
308
  reply.compress(buf)
309
309
  })
310
310
 
@@ -326,7 +326,7 @@ describe('It should send compressed Buffer data when `global` is `true` :', asyn
326
326
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
327
327
 
328
328
  const buf = Buffer.from('hello world')
329
- fastify.get('/', (request, reply) => {
329
+ fastify.get('/', (_request, reply) => {
330
330
  reply.compress(buf)
331
331
  })
332
332
 
@@ -348,7 +348,7 @@ describe('It should send compressed Buffer data when `global` is `true` :', asyn
348
348
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
349
349
 
350
350
  const buf = Buffer.from('hello world')
351
- fastify.get('/', (request, reply) => {
351
+ fastify.get('/', (_request, reply) => {
352
352
  reply.compress(buf)
353
353
  })
354
354
 
@@ -372,7 +372,7 @@ describe('It should send compressed JSON data when `global` is `true` :', async
372
372
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
373
373
 
374
374
  const json = { hello: 'world' }
375
- fastify.get('/', (request, reply) => {
375
+ fastify.get('/', (_request, reply) => {
376
376
  reply.compress(json)
377
377
  })
378
378
 
@@ -394,7 +394,7 @@ describe('It should send compressed JSON data when `global` is `true` :', async
394
394
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
395
395
 
396
396
  const json = { hello: 'world' }
397
- fastify.get('/', (request, reply) => {
397
+ fastify.get('/', (_request, reply) => {
398
398
  reply.compress(json)
399
399
  })
400
400
 
@@ -416,7 +416,7 @@ describe('It should send compressed JSON data when `global` is `true` :', async
416
416
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
417
417
 
418
418
  const json = { hello: 'world' }
419
- fastify.get('/', (request, reply) => {
419
+ fastify.get('/', (_request, reply) => {
420
420
  reply.compress(json)
421
421
  })
422
422
 
@@ -439,7 +439,7 @@ describe('It should fallback to the default `gzip` encoding compression :', asyn
439
439
  const fastify = Fastify()
440
440
  await fastify.register(compressPlugin, { global: true })
441
441
 
442
- fastify.get('/', (request, reply) => {
442
+ fastify.get('/', (_request, reply) => {
443
443
  reply
444
444
  .type('text/plain')
445
445
  .compress(createReadStream('./package.json'))
@@ -465,7 +465,7 @@ describe('It should fallback to the default `gzip` encoding compression :', asyn
465
465
  const fastify = Fastify()
466
466
  await fastify.register(compressPlugin, { global: true })
467
467
 
468
- fastify.get('/', (request, reply) => {
468
+ fastify.get('/', (_request, reply) => {
469
469
  reply
470
470
  .type('text/plain')
471
471
  .compress(createReadStream('./package.json'))
@@ -496,7 +496,7 @@ describe('When a custom `zlib` option is provided, it should compress data :`',
496
496
  const fastify = Fastify()
497
497
  await fastify.register(compressPlugin, { global: true, zlib: customZlib })
498
498
 
499
- fastify.get('/', (request, reply) => {
499
+ fastify.get('/', (_request, reply) => {
500
500
  reply
501
501
  .type('text/plain')
502
502
  .compress(createReadStream('./package.json'))
@@ -528,7 +528,7 @@ describe('When a custom `zlib` option is provided, it should compress data :`',
528
528
  const fastify = Fastify()
529
529
  await fastify.register(compressPlugin, { global: true, zlib: customZlib })
530
530
 
531
- fastify.get('/', (request, reply) => {
531
+ fastify.get('/', (_request, reply) => {
532
532
  reply
533
533
  .type('text/plain')
534
534
  .compress(createReadStream('./package.json'))
@@ -560,7 +560,7 @@ describe('When a custom `zlib` option is provided, it should compress data :`',
560
560
  const fastify = Fastify()
561
561
  await fastify.register(compressPlugin, { global: true, zlib: customZlib })
562
562
 
563
- fastify.get('/', (request, reply) => {
563
+ fastify.get('/', (_request, reply) => {
564
564
  reply
565
565
  .type('text/plain')
566
566
  .compress(createReadStream('./package.json'))
@@ -594,7 +594,7 @@ describe('When a malformed custom `zlib` option is provided, it should compress
594
594
  zlib: true // will trigger a fallback on the default zlib.createBrotliCompress
595
595
  })
596
596
 
597
- fastify.get('/', (request, reply) => {
597
+ fastify.get('/', (_request, reply) => {
598
598
  reply
599
599
  .type('text/plain')
600
600
  .compress('hello')
@@ -621,7 +621,7 @@ describe('When a malformed custom `zlib` option is provided, it should compress
621
621
  zlib: true // will trigger a fallback on the default zlib.createDeflate
622
622
  })
623
623
 
624
- fastify.get('/', (request, reply) => {
624
+ fastify.get('/', (_request, reply) => {
625
625
  reply
626
626
  .type('text/plain')
627
627
  .compress('hello')
@@ -648,7 +648,7 @@ describe('When a malformed custom `zlib` option is provided, it should compress
648
648
  zlib: true // will trigger a fallback on the default zlib.createGzip
649
649
  })
650
650
 
651
- fastify.get('/', (request, reply) => {
651
+ fastify.get('/', (_request, reply) => {
652
652
  reply
653
653
  .type('text/plain')
654
654
  .compress('hello')
@@ -674,7 +674,7 @@ describe('When `inflateIfDeflated` is `true` and `X-No-Compression` request head
674
674
  await fastify.register(compressPlugin, { threshold: 0, inflateIfDeflated: true })
675
675
 
676
676
  const json = { hello: 'world' }
677
- fastify.get('/', (request, reply) => {
677
+ fastify.get('/', (_request, reply) => {
678
678
  reply.send(zlib.deflateSync(JSON.stringify(json)))
679
679
  })
680
680
 
@@ -698,7 +698,7 @@ describe('When `inflateIfDeflated` is `true` and `X-No-Compression` request head
698
698
  await fastify.register(compressPlugin, { threshold: 0, inflateIfDeflated: true })
699
699
 
700
700
  const json = { hello: 'world' }
701
- fastify.get('/', (request, reply) => {
701
+ fastify.get('/', (_request, reply) => {
702
702
  reply.send(zlib.gzipSync(JSON.stringify(json)))
703
703
  })
704
704
 
@@ -727,7 +727,7 @@ test('it should not uncompress payloads using the zip algorithm', async (t) => {
727
727
  zip.addFile('file.zip', Buffer.from(JSON.stringify(json), 'utf-8'))
728
728
  const fileBuffer = zip.toBuffer()
729
729
 
730
- fastify.get('/', (request, reply) => {
730
+ fastify.get('/', (_request, reply) => {
731
731
  reply.compress(fileBuffer)
732
732
  })
733
733
 
@@ -753,7 +753,7 @@ describe('It should not compress :', async () => {
753
753
  const fastify = Fastify()
754
754
  await fastify.register(compressPlugin, { threshold: 128 })
755
755
 
756
- fastify.get('/', (request, reply) => {
756
+ fastify.get('/', (_request, reply) => {
757
757
  reply
758
758
  .type('text/plain')
759
759
  .compress('a message')
@@ -778,7 +778,7 @@ describe('It should not compress :', async () => {
778
778
  const fastify = Fastify()
779
779
  await fastify.register(compressPlugin, { customTypes: /x-user-header$/u })
780
780
 
781
- fastify.get('/', (request, reply) => {
781
+ fastify.get('/', (_request, reply) => {
782
782
  reply
783
783
  .type('application/x-other-type')
784
784
  .compress(createReadStream('./package.json'))
@@ -802,7 +802,7 @@ describe('It should not compress :', async () => {
802
802
  const fastify = Fastify()
803
803
  await fastify.register(compressPlugin, { customTypes: value => value === 'application/x-user-header' })
804
804
 
805
- fastify.get('/', (request, reply) => {
805
+ fastify.get('/', (_request, reply) => {
806
806
  reply
807
807
  .type('application/x-other-type')
808
808
  .compress(createReadStream('./package.json'))
@@ -827,7 +827,7 @@ describe('It should not compress :', async () => {
827
827
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
828
828
 
829
829
  const json = { hello: 'world' }
830
- fastify.get('/', (request, reply) => {
830
+ fastify.get('/', (_request, reply) => {
831
831
  reply.compress(json)
832
832
  })
833
833
 
@@ -850,12 +850,12 @@ describe('It should not compress :', async () => {
850
850
  const fastify = Fastify()
851
851
  await fastify.register(compressPlugin, { threshold: 0 })
852
852
 
853
- fastify.addHook('onSend', async (request, response) => {
853
+ fastify.addHook('onSend', async (_request, response) => {
854
854
  response.header('Content-Type', undefined)
855
855
  })
856
856
 
857
857
  const json = { hello: 'world' }
858
- fastify.get('/', (request, reply) => {
858
+ fastify.get('/', (_request, reply) => {
859
859
  // The auto-dectection will fallback as an 'application/json' type
860
860
  reply.compress(json)
861
861
  })
@@ -879,7 +879,7 @@ describe('It should not compress :', async () => {
879
879
  const fastify = Fastify()
880
880
  await fastify.register(compressPlugin, { threshold: 0 })
881
881
 
882
- fastify.get('/', (request, reply) => {
882
+ fastify.get('/', (_request, reply) => {
883
883
  reply
884
884
  .type('image/webp')
885
885
  .compress('hello')
@@ -932,7 +932,7 @@ describe('It should not compress :', async () => {
932
932
  const fastify = Fastify()
933
933
  await fastify.register(compressPlugin, { threshold: 0 })
934
934
 
935
- fastify.get('/', (request, reply) => {
935
+ fastify.get('/', (_request, reply) => {
936
936
  reply
937
937
  .type('something/invalid')
938
938
  .compress('a message')
@@ -957,7 +957,7 @@ describe('It should not compress :', async () => {
957
957
  const fastify = Fastify()
958
958
  await fastify.register(compressPlugin, { global: true })
959
959
 
960
- fastify.get('/', (request, reply) => {
960
+ fastify.get('/', (_request, reply) => {
961
961
  reply
962
962
  .type('text/plain')
963
963
  .compress(createReadStream('./package.json'))
@@ -978,7 +978,7 @@ describe('It should not compress :', async () => {
978
978
  const fastify = Fastify()
979
979
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
980
980
 
981
- fastify.get('/', (request, reply) => {
981
+ fastify.get('/', (_request, reply) => {
982
982
  reply.compress({ hello: 'world' })
983
983
  })
984
984
 
@@ -1001,7 +1001,7 @@ describe('It should not compress :', async () => {
1001
1001
  const fastify = Fastify()
1002
1002
  await fastify.register(compressPlugin, { global: true })
1003
1003
 
1004
- fastify.get('/', (request, reply) => {
1004
+ fastify.get('/', (_request, reply) => {
1005
1005
  reply
1006
1006
  .type('text/plain')
1007
1007
  .compress(createReadStream('./package.json'))
@@ -1026,7 +1026,7 @@ describe('It should not compress :', async () => {
1026
1026
  const fastify = Fastify()
1027
1027
  await fastify.register(compressPlugin, { global: true })
1028
1028
 
1029
- fastify.get('/', (request, reply) => {
1029
+ fastify.get('/', (_request, reply) => {
1030
1030
  reply
1031
1031
  .type('text/plain')
1032
1032
  .compress(createReadStream('./package.json'))
@@ -1051,7 +1051,7 @@ describe('It should not compress :', async () => {
1051
1051
  const fastify = Fastify()
1052
1052
  await fastify.register(compressPlugin, { global: true, inflateIfDeflated: true, threshold: 0 })
1053
1053
 
1054
- fastify.get('/', (request, reply) => {
1054
+ fastify.get('/', (_request, reply) => {
1055
1055
  reply.compress({ hello: 'world' })
1056
1056
  })
1057
1057
 
@@ -1076,7 +1076,7 @@ describe('It should not compress :', async () => {
1076
1076
  const fastify = Fastify()
1077
1077
  await fastify.register(compressPlugin, { threshold: 0 })
1078
1078
 
1079
- fastify.get('/', (request, reply) => {
1079
+ fastify.get('/', (_request, reply) => {
1080
1080
  reply.send(undefined)
1081
1081
  })
1082
1082
 
@@ -1099,7 +1099,7 @@ describe('It should not compress :', async () => {
1099
1099
  const fastify = Fastify()
1100
1100
  await fastify.register(compressPlugin, { threshold: 128 })
1101
1101
 
1102
- fastify.get('/', (request, reply) => {
1102
+ fastify.get('/', (_request, reply) => {
1103
1103
  reply
1104
1104
  .header('Content-Type', 'text/plain')
1105
1105
  .send('a message')
@@ -1124,7 +1124,7 @@ describe('It should not compress :', async () => {
1124
1124
  const fastify = Fastify()
1125
1125
  await fastify.register(compressPlugin, { customTypes: /x-user-header$/u })
1126
1126
 
1127
- fastify.get('/', (request, reply) => {
1127
+ fastify.get('/', (_request, reply) => {
1128
1128
  reply
1129
1129
  .type('application/x-other-type')
1130
1130
  .send(createReadStream('./package.json'))
@@ -1149,7 +1149,7 @@ describe('It should not compress :', async () => {
1149
1149
  await fastify.register(compressPlugin, { threshold: 0 })
1150
1150
 
1151
1151
  const json = { hello: 'world' }
1152
- fastify.get('/', (request, reply) => {
1152
+ fastify.get('/', (_request, reply) => {
1153
1153
  reply.send(json)
1154
1154
  })
1155
1155
 
@@ -1172,12 +1172,12 @@ describe('It should not compress :', async () => {
1172
1172
  const fastify = Fastify()
1173
1173
  await fastify.register(compressPlugin, { threshold: 0 })
1174
1174
 
1175
- fastify.addHook('onSend', async (request, response) => {
1175
+ fastify.addHook('onSend', async (_request, response) => {
1176
1176
  response.header('Content-Type', undefined)
1177
1177
  })
1178
1178
 
1179
1179
  const json = { hello: 'world' }
1180
- fastify.get('/', (request, reply) => {
1180
+ fastify.get('/', (_request, reply) => {
1181
1181
  // The auto-dectection will fallback as an 'application/json' type
1182
1182
  reply.send(json)
1183
1183
  })
@@ -1201,7 +1201,7 @@ describe('It should not compress :', async () => {
1201
1201
  const fastify = Fastify()
1202
1202
  await fastify.register(compressPlugin, { threshold: 0 })
1203
1203
 
1204
- fastify.get('/', (request, reply) => {
1204
+ fastify.get('/', (_request, reply) => {
1205
1205
  reply
1206
1206
  .type('image/webp')
1207
1207
  .send('hello')
@@ -1254,7 +1254,7 @@ describe('It should not compress :', async () => {
1254
1254
  const fastify = Fastify()
1255
1255
  await fastify.register(compressPlugin, { threshold: 0 })
1256
1256
 
1257
- fastify.get('/', (request, reply) => {
1257
+ fastify.get('/', (_request, reply) => {
1258
1258
  reply
1259
1259
  .header('Content-Type', 'something/invalid')
1260
1260
  .send('a message')
@@ -1279,7 +1279,7 @@ describe('It should not compress :', async () => {
1279
1279
  const fastify = Fastify()
1280
1280
  await fastify.register(compressPlugin, { global: true })
1281
1281
 
1282
- fastify.get('/', (request, reply) => {
1282
+ fastify.get('/', (_request, reply) => {
1283
1283
  reply
1284
1284
  .header('Content-Type', 'text/plain')
1285
1285
  .send(createReadStream('./package.json'))
@@ -1300,7 +1300,7 @@ describe('It should not compress :', async () => {
1300
1300
  const fastify = Fastify()
1301
1301
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
1302
1302
 
1303
- fastify.get('/', (request, reply) => {
1303
+ fastify.get('/', (_request, reply) => {
1304
1304
  reply.send({ hello: 'world' })
1305
1305
  })
1306
1306
 
@@ -1323,7 +1323,7 @@ describe('It should not compress :', async () => {
1323
1323
  const fastify = Fastify()
1324
1324
  await fastify.register(compressPlugin, { global: true })
1325
1325
 
1326
- fastify.get('/', (request, reply) => {
1326
+ fastify.get('/', (_request, reply) => {
1327
1327
  reply
1328
1328
  .header('Content-Type', 'text/plain')
1329
1329
  .send('something')
@@ -1346,7 +1346,7 @@ describe('It should not compress :', async () => {
1346
1346
  const fastify = Fastify()
1347
1347
  await fastify.register(compressPlugin, { global: true })
1348
1348
 
1349
- fastify.get('/', (request, reply) => {
1349
+ fastify.get('/', (_request, reply) => {
1350
1350
  reply
1351
1351
  .header('Content-Type', 'text/plain')
1352
1352
  .send(createReadStream('./package.json'))
@@ -1371,7 +1371,7 @@ describe('It should not compress :', async () => {
1371
1371
  const fastify = Fastify()
1372
1372
  await fastify.register(compressPlugin, { global: true, inflateIfDeflated: true, threshold: 0 })
1373
1373
 
1374
- fastify.get('/', (request, reply) => {
1374
+ fastify.get('/', (_request, reply) => {
1375
1375
  reply.send({ hello: 'world' })
1376
1376
  })
1377
1377
 
@@ -1397,7 +1397,7 @@ describe('It should not double-compress :', async () => {
1397
1397
  const fastify = Fastify()
1398
1398
  await fastify.register(compressPlugin, { global: true })
1399
1399
 
1400
- fastify.get('/', (request, reply) => {
1400
+ fastify.get('/', (_request, reply) => {
1401
1401
  reply
1402
1402
  .type('text/plain')
1403
1403
  .compress(
@@ -1425,7 +1425,7 @@ describe('It should not double-compress :', async () => {
1425
1425
  const fastify = Fastify()
1426
1426
  await fastify.register(compressPlugin, { global: true })
1427
1427
 
1428
- fastify.get('/', (request, reply) => {
1428
+ fastify.get('/', (_request, reply) => {
1429
1429
  reply
1430
1430
  .type('text/plain')
1431
1431
  .compress(
@@ -1454,7 +1454,7 @@ describe('It should not double-compress :', async () => {
1454
1454
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
1455
1455
 
1456
1456
  const file = readFileSync('./package.json', 'utf8')
1457
- fastify.get('/', (request, reply) => {
1457
+ fastify.get('/', (_request, reply) => {
1458
1458
  const payload = zlib.brotliCompressSync(file)
1459
1459
 
1460
1460
  reply
@@ -1485,7 +1485,7 @@ describe('It should not double-compress :', async () => {
1485
1485
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
1486
1486
 
1487
1487
  const file = readFileSync('./package.json', 'utf8')
1488
- fastify.get('/', (request, reply) => {
1488
+ fastify.get('/', (_request, reply) => {
1489
1489
  const payload = zlib.deflateSync(file)
1490
1490
 
1491
1491
  reply
@@ -1516,7 +1516,7 @@ describe('It should not double-compress :', async () => {
1516
1516
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
1517
1517
 
1518
1518
  const file = readFileSync('./package.json', 'utf8')
1519
- fastify.get('/', (request, reply) => {
1519
+ fastify.get('/', (_request, reply) => {
1520
1520
  const payload = zlib.gzipSync(file)
1521
1521
 
1522
1522
  reply
@@ -1549,7 +1549,7 @@ describe('It should not compress Stream data and add a `Content-Encoding` reply
1549
1549
  const fastify = Fastify()
1550
1550
  await fastify.register(compressPlugin, { global: true, inflateIfDeflated: true })
1551
1551
 
1552
- fastify.get('/', (request, reply) => {
1552
+ fastify.get('/', (_request, reply) => {
1553
1553
  reply
1554
1554
  .header('Content-Type', 'application/octet-stream')
1555
1555
  .send(createReadStream('./package.json'))
@@ -1579,7 +1579,7 @@ describe('It should not compress Stream data and add a `Content-Encoding` reply
1579
1579
  encodings: ['deflate', 'gzip']
1580
1580
  })
1581
1581
 
1582
- fastify.get('/', (request, reply) => {
1582
+ fastify.get('/', (_request, reply) => {
1583
1583
  reply.send(createReadStream('./package.json'))
1584
1584
  })
1585
1585
 
@@ -1606,7 +1606,7 @@ describe('It should not compress Stream data and add a `Content-Encoding` reply
1606
1606
  const fastify = Fastify()
1607
1607
  await fastify.register(compressPlugin, { global: true, inflateIfDeflated: true })
1608
1608
 
1609
- fastify.get('/', (request, reply) => {
1609
+ fastify.get('/', (_request, reply) => {
1610
1610
  reply
1611
1611
  .type('application/octet-stream')
1612
1612
  .compress(createReadStream('./package.json'))
@@ -1636,7 +1636,7 @@ describe('It should not compress Stream data and add a `Content-Encoding` reply
1636
1636
  encodings: ['deflate', 'gzip']
1637
1637
  })
1638
1638
 
1639
- fastify.get('/', (request, reply) => {
1639
+ fastify.get('/', (_request, reply) => {
1640
1640
  reply.compress(createReadStream('./package.json'))
1641
1641
  })
1642
1642
 
@@ -1670,11 +1670,11 @@ test('It should return a serialized payload when `inflateIfDeflated` is `true` a
1670
1670
  const json = { hello: 'world' }
1671
1671
  const compressedBufferPayload = zlib.brotliCompressSync(Buffer.from(json.toString()))
1672
1672
 
1673
- fastify.get('/one', (request, reply) => {
1673
+ fastify.get('/one', (_request, reply) => {
1674
1674
  reply.send(json)
1675
1675
  })
1676
1676
 
1677
- fastify.get('/two', (request, reply) => {
1677
+ fastify.get('/two', (_request, reply) => {
1678
1678
  reply.send(compressedBufferPayload)
1679
1679
  })
1680
1680
 
@@ -1712,7 +1712,7 @@ test('It should close the stream', async (t) => {
1712
1712
  const stream = createReadStream('./package.json')
1713
1713
  const closed = once(stream, 'close')
1714
1714
 
1715
- fastify.get('/', (request, reply) => {
1715
+ fastify.get('/', (_request, reply) => {
1716
1716
  stream.on('close', () => t.assert.ok('stream closed'))
1717
1717
 
1718
1718
  reply
@@ -1736,7 +1736,7 @@ test('It should log an existing error with stream onEnd handler', async (t) => {
1736
1736
 
1737
1737
  let actual = null
1738
1738
  const logger = new Writable({
1739
- write (chunk, encoding, callback) {
1739
+ write (chunk, _encoding, callback) {
1740
1740
  actual = JSON.parse(chunk.toString())
1741
1741
  callback()
1742
1742
  }
@@ -1753,9 +1753,9 @@ test('It should log an existing error with stream onEnd handler', async (t) => {
1753
1753
 
1754
1754
  const expect = new Error('something wrong')
1755
1755
 
1756
- fastify.get('/', (request, reply) => {
1756
+ fastify.get('/', (_request, reply) => {
1757
1757
  const stream = new Readable({
1758
- read (size) {
1758
+ read () {
1759
1759
  this.destroy(expect)
1760
1760
  }
1761
1761
  })
@@ -1782,7 +1782,7 @@ describe('It should support stream1 :', async () => {
1782
1782
  const fastify = Fastify()
1783
1783
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
1784
1784
 
1785
- fastify.get('/', (request, reply) => {
1785
+ fastify.get('/', (_request, reply) => {
1786
1786
  const stream = JSONStream.stringify()
1787
1787
 
1788
1788
  reply
@@ -1812,7 +1812,7 @@ describe('It should support stream1 :', async () => {
1812
1812
  const fastify = Fastify()
1813
1813
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
1814
1814
 
1815
- fastify.get('/', (request, reply) => {
1815
+ fastify.get('/', (_request, reply) => {
1816
1816
  const stream = JSONStream.stringify()
1817
1817
 
1818
1818
  reply
@@ -1844,7 +1844,7 @@ describe('It should remove `Content-Length` header :', async () => {
1844
1844
  const fastify = Fastify()
1845
1845
  await fastify.register(compressPlugin, { global: true })
1846
1846
 
1847
- fastify.get('/', (request, reply) => {
1847
+ fastify.get('/', (_request, reply) => {
1848
1848
  readFile('./package.json', 'utf8', (err, data) => {
1849
1849
  if (err) {
1850
1850
  return reply.send(err)
@@ -1878,7 +1878,7 @@ describe('It should remove `Content-Length` header :', async () => {
1878
1878
  const fastify = Fastify()
1879
1879
  await fastify.register(compressPlugin, { global: true, inflateIfDeflated: true })
1880
1880
 
1881
- fastify.get('/', (request, reply) => {
1881
+ fastify.get('/', (_request, reply) => {
1882
1882
  reply
1883
1883
  .type('application/octet-stream')
1884
1884
  .compress(createReadStream('./package.json'))
@@ -1904,7 +1904,7 @@ describe('It should remove `Content-Length` header :', async () => {
1904
1904
  const fastify = Fastify()
1905
1905
  await fastify.register(compressPlugin, { global: true })
1906
1906
 
1907
- fastify.get('/', (request, reply) => {
1907
+ fastify.get('/', (_request, reply) => {
1908
1908
  readFile('./package.json', 'utf8', (err, data) => {
1909
1909
  if (err) {
1910
1910
  return reply.send(err)
@@ -1938,7 +1938,7 @@ describe('It should remove `Content-Length` header :', async () => {
1938
1938
  const fastify = Fastify()
1939
1939
  await fastify.register(compressPlugin, { global: true, inflateIfDeflated: true })
1940
1940
 
1941
- fastify.get('/', (request, reply) => {
1941
+ fastify.get('/', (_request, reply) => {
1942
1942
  reply
1943
1943
  .header('Content-Type', 'application/octet-stream')
1944
1944
  .send(createReadStream('./package.json'))
@@ -1966,7 +1966,7 @@ describe('When `removeContentLengthHeader` is `false`, it should not remove `Con
1966
1966
  const fastify = Fastify()
1967
1967
  await fastify.register(compressPlugin, { global: true, removeContentLengthHeader: false })
1968
1968
 
1969
- fastify.get('/', (request, reply) => {
1969
+ fastify.get('/', (_request, reply) => {
1970
1970
  readFile('./package.json', 'utf8', (err, data) => {
1971
1971
  if (err) {
1972
1972
  return reply.send(err)
@@ -2000,7 +2000,7 @@ describe('When `removeContentLengthHeader` is `false`, it should not remove `Con
2000
2000
  const fastify = Fastify()
2001
2001
  await fastify.register(compressPlugin, { global: true, removeContentLengthHeader: false })
2002
2002
 
2003
- fastify.get('/', (request, reply) => {
2003
+ fastify.get('/', (_request, reply) => {
2004
2004
  readFile('./package.json', 'utf8', (err, data) => {
2005
2005
  if (err) {
2006
2006
  return reply.send(err)
@@ -2035,7 +2035,7 @@ describe('It should add hooks correctly: ', async () => {
2035
2035
 
2036
2036
  const fastify = Fastify()
2037
2037
 
2038
- fastify.addHook('onRequest', async (request, reply) => {
2038
+ fastify.addHook('onRequest', async (_request, reply) => {
2039
2039
  reply.header('x-fastify-global-test', 'ok')
2040
2040
  })
2041
2041
 
@@ -2043,23 +2043,23 @@ describe('It should add hooks correctly: ', async () => {
2043
2043
 
2044
2044
  fastify.get('/one', {
2045
2045
  onRequest: [
2046
- async (request, reply) => { reply.header('x-fastify-test-one', 'ok') }
2046
+ async (_request, reply) => { reply.header('x-fastify-test-one', 'ok') }
2047
2047
  ]
2048
- }, (request, reply) => {
2048
+ }, (_request, reply) => {
2049
2049
  reply
2050
2050
  .type('text/plain')
2051
2051
  .compress(createReadStream('./package.json'))
2052
2052
  })
2053
2053
 
2054
2054
  fastify.get('/two', {
2055
- onRequest: async (request, reply) => { reply.header('x-fastify-test-two', 'ok') }
2056
- }, (request, reply) => {
2055
+ onRequest: async (_request, reply) => { reply.header('x-fastify-test-two', 'ok') }
2056
+ }, (_request, reply) => {
2057
2057
  reply
2058
2058
  .type('text/plain')
2059
2059
  .compress(createReadStream('./package.json'))
2060
2060
  })
2061
2061
 
2062
- fastify.get('/three', { onRequest: null }, (request, reply) => {
2062
+ fastify.get('/three', { onRequest: null }, (_request, reply) => {
2063
2063
  reply
2064
2064
  .type('text/plain')
2065
2065
  .compress(createReadStream('./package.json'))
@@ -2122,7 +2122,7 @@ describe('It should add hooks correctly: ', async () => {
2122
2122
 
2123
2123
  const fastify = Fastify()
2124
2124
 
2125
- fastify.addHook('onSend', async (request, reply) => {
2125
+ fastify.addHook('onSend', async (_request, reply) => {
2126
2126
  reply.header('x-fastify-global-test', 'ok')
2127
2127
  })
2128
2128
 
@@ -2130,23 +2130,23 @@ describe('It should add hooks correctly: ', async () => {
2130
2130
 
2131
2131
  fastify.get('/one', {
2132
2132
  onSend: [
2133
- async (request, reply) => { reply.header('x-fastify-test-one', 'ok') }
2133
+ async (_request, reply) => { reply.header('x-fastify-test-one', 'ok') }
2134
2134
  ]
2135
- }, (request, reply) => {
2135
+ }, (_request, reply) => {
2136
2136
  reply
2137
2137
  .type('text/plain')
2138
2138
  .compress(createReadStream('./package.json'))
2139
2139
  })
2140
2140
 
2141
2141
  fastify.get('/two', {
2142
- onSend: async (request, reply) => { reply.header('x-fastify-test-two', 'ok') }
2143
- }, (request, reply) => {
2142
+ onSend: async (_request, reply) => { reply.header('x-fastify-test-two', 'ok') }
2143
+ }, (_request, reply) => {
2144
2144
  reply
2145
2145
  .type('text/plain')
2146
2146
  .compress(createReadStream('./package.json'))
2147
2147
  })
2148
2148
 
2149
- fastify.get('/three', { onSend: null }, (request, reply) => {
2149
+ fastify.get('/three', { onSend: null }, (_request, reply) => {
2150
2150
  reply
2151
2151
  .type('text/plain')
2152
2152
  .compress(createReadStream('./package.json'))
@@ -2209,7 +2209,7 @@ describe('It should add hooks correctly: ', async () => {
2209
2209
 
2210
2210
  const fastify = Fastify()
2211
2211
 
2212
- fastify.addHook('preParsing', async (request, reply, payload) => {
2212
+ fastify.addHook('preParsing', async (_request, reply, payload) => {
2213
2213
  reply.header('x-fastify-global-test', 'ok')
2214
2214
  return payload
2215
2215
  })
@@ -2218,29 +2218,29 @@ describe('It should add hooks correctly: ', async () => {
2218
2218
 
2219
2219
  fastify.get('/one', {
2220
2220
  preParsing: [
2221
- async (request, reply, payload) => {
2221
+ async (_request, reply, payload) => {
2222
2222
  reply.header('x-fastify-test-one', 'ok')
2223
2223
  return payload
2224
2224
  }
2225
2225
  ]
2226
- }, (request, reply) => {
2226
+ }, (_request, reply) => {
2227
2227
  reply
2228
2228
  .type('text/plain')
2229
2229
  .compress(createReadStream('./package.json'))
2230
2230
  })
2231
2231
 
2232
2232
  fastify.get('/two', {
2233
- preParsing: async (request, reply, payload) => {
2233
+ preParsing: async (_request, reply, payload) => {
2234
2234
  reply.header('x-fastify-test-two', 'ok')
2235
2235
  return payload
2236
2236
  }
2237
- }, (request, reply) => {
2237
+ }, (_request, reply) => {
2238
2238
  reply
2239
2239
  .type('text/plain')
2240
2240
  .compress(createReadStream('./package.json'))
2241
2241
  })
2242
2242
 
2243
- fastify.get('/three', { preParsing: null }, (request, reply) => {
2243
+ fastify.get('/three', { preParsing: null }, (_request, reply) => {
2244
2244
  reply
2245
2245
  .type('text/plain')
2246
2246
  .compress(createReadStream('./package.json'))
@@ -2306,13 +2306,13 @@ describe('When `Accept-Encoding` request header values are not supported and `on
2306
2306
  const fastify = Fastify()
2307
2307
  await fastify.register(compressPlugin, {
2308
2308
  global: true,
2309
- onUnsupportedEncoding: (encoding, request, reply) => {
2309
+ onUnsupportedEncoding: (encoding, _request, reply) => {
2310
2310
  reply.code(406)
2311
2311
  return JSON.stringify({ hello: encoding })
2312
2312
  }
2313
2313
  })
2314
2314
 
2315
- fastify.get('/', (request, reply) => {
2315
+ fastify.get('/', (_request, reply) => {
2316
2316
  reply
2317
2317
  .header('Content-Type', 'text/plain')
2318
2318
  .send(createReadStream('./package.json'))
@@ -2335,13 +2335,13 @@ describe('When `Accept-Encoding` request header values are not supported and `on
2335
2335
  const fastify = Fastify()
2336
2336
  await fastify.register(compressPlugin, {
2337
2337
  global: true,
2338
- onUnsupportedEncoding: (encoding, request, reply) => {
2338
+ onUnsupportedEncoding: (_encoding, _request, reply) => {
2339
2339
  reply.code(406)
2340
2340
  throw new Error('testing error')
2341
2341
  }
2342
2342
  })
2343
2343
 
2344
- fastify.get('/', (request, reply) => {
2344
+ fastify.get('/', (_request, reply) => {
2345
2345
  reply
2346
2346
  .header('Content-Type', 'text/plain')
2347
2347
  .send(createReadStream('./package.json'))
@@ -2372,7 +2372,7 @@ describe('`Accept-Encoding` request header values :', async () => {
2372
2372
 
2373
2373
  const json = { hello: 'world' }
2374
2374
 
2375
- fastify.get('/', (request, reply) => {
2375
+ fastify.get('/', (_request, reply) => {
2376
2376
  reply.send(json)
2377
2377
  })
2378
2378
 
@@ -2395,7 +2395,7 @@ describe('`Accept-Encoding` request header values :', async () => {
2395
2395
  const fastify = Fastify()
2396
2396
  await fastify.register(compressPlugin, { global: true })
2397
2397
 
2398
- fastify.get('/', (request, reply) => {
2398
+ fastify.get('/', (_request, reply) => {
2399
2399
  reply
2400
2400
  .type('text/plain')
2401
2401
  .compress(createReadStream('./package.json'))
@@ -2422,7 +2422,7 @@ describe('`Accept-Encoding` request header values :', async () => {
2422
2422
  await fastify.register(compressPlugin, { global: true, threshold: 0 })
2423
2423
 
2424
2424
  const buf = Buffer.from('hello world')
2425
- fastify.get('/', (request, reply) => {
2425
+ fastify.get('/', (_request, reply) => {
2426
2426
  reply.compress(buf)
2427
2427
  })
2428
2428
 
@@ -2443,7 +2443,7 @@ describe('`Accept-Encoding` request header values :', async () => {
2443
2443
  const fastify = Fastify()
2444
2444
  await fastify.register(compressPlugin, { global: true })
2445
2445
 
2446
- fastify.get('/', (request, reply) => {
2446
+ fastify.get('/', (_request, reply) => {
2447
2447
  reply
2448
2448
  .type('text/plain')
2449
2449
  .compress(
@@ -2471,7 +2471,7 @@ describe('`Accept-Encoding` request header values :', async () => {
2471
2471
  const fastify = Fastify()
2472
2472
  await fastify.register(compressPlugin, { global: true })
2473
2473
 
2474
- fastify.get('/', (request, reply) => {
2474
+ fastify.get('/', (_request, reply) => {
2475
2475
  reply
2476
2476
  .type('text/plain')
2477
2477
  .compress(
@@ -2499,7 +2499,7 @@ test('It should compress data if `customTypes` is set and matches `Content-Type`
2499
2499
  const fastify = Fastify()
2500
2500
  await fastify.register(compressPlugin, { customTypes: /x-user-header$/u })
2501
2501
 
2502
- fastify.get('/', (request, reply) => {
2502
+ fastify.get('/', (_request, reply) => {
2503
2503
  reply
2504
2504
  .type('application/x-user-header')
2505
2505
  .send(createReadStream('./package.json'))
@@ -2524,7 +2524,7 @@ test('It should compress data if `customTypes` is a function and returns true on
2524
2524
  const fastify = Fastify()
2525
2525
  await fastify.register(compressPlugin, { customTypes: value => value === 'application/x-user-header' })
2526
2526
 
2527
- fastify.get('/', (request, reply) => {
2527
+ fastify.get('/', (_request, reply) => {
2528
2528
  reply
2529
2529
  .type('application/x-user-header')
2530
2530
  .send(createReadStream('./package.json'))
@@ -2550,7 +2550,7 @@ test('It should not apply `customTypes` option if the passed value is not a RegE
2550
2550
  const fastify = Fastify()
2551
2551
  await fastify.register(compressPlugin, { customTypes: 'x-user-header' })
2552
2552
 
2553
- fastify.get('/', (request, reply) => {
2553
+ fastify.get('/', (_request, reply) => {
2554
2554
  reply
2555
2555
  .type('application/x-user-header')
2556
2556
  .send(createReadStream('./package.json'))
@@ -2574,7 +2574,7 @@ test('When `encodings` option is set, it should only use the registered value',
2574
2574
  const fastify = Fastify()
2575
2575
  await fastify.register(compressPlugin, { encodings: ['deflate'] })
2576
2576
 
2577
- fastify.get('/', (request, reply) => {
2577
+ fastify.get('/', (_request, reply) => {
2578
2578
  reply.send(createReadStream('./package.json'))
2579
2579
  })
2580
2580
 
@@ -2603,7 +2603,7 @@ describe('It should send data compressed according to `brotliOptions` :', async
2603
2603
  const fastify = Fastify()
2604
2604
  await fastify.register(compressPlugin, { global: true, brotliOptions })
2605
2605
 
2606
- fastify.get('/', (request, reply) => {
2606
+ fastify.get('/', (_request, reply) => {
2607
2607
  reply
2608
2608
  .type('text/plain')
2609
2609
  .compress(createReadStream('./package.json'))
@@ -2634,7 +2634,7 @@ describe('It should send data compressed according to `brotliOptions` :', async
2634
2634
  await fastify.register(compressPlugin, { global: true })
2635
2635
 
2636
2636
  const file = readFileSync('./package.json', 'utf8')
2637
- fastify.get('/', (request, reply) => {
2637
+ fastify.get('/', (_request, reply) => {
2638
2638
  reply
2639
2639
  .type('text/plain')
2640
2640
  .compress(file)
@@ -2671,7 +2671,7 @@ describe('It should send data compressed according to `zlibOptions` :', async ()
2671
2671
  zlibOptions
2672
2672
  })
2673
2673
 
2674
- fastify.get('/', (request, reply) => {
2674
+ fastify.get('/', (_request, reply) => {
2675
2675
  reply
2676
2676
  .type('text/plain')
2677
2677
  .compress(createReadStream('./package.json'))
@@ -2701,7 +2701,7 @@ describe('It should send data compressed according to `zlibOptions` :', async ()
2701
2701
  zlibOptions
2702
2702
  })
2703
2703
 
2704
- fastify.get('/', (request, reply) => {
2704
+ fastify.get('/', (_request, reply) => {
2705
2705
  reply
2706
2706
  .type('text/plain')
2707
2707
  .compress(createReadStream('./package.json'))
@@ -2727,14 +2727,14 @@ test('It should concat `accept-encoding` to `Vary` reply header if present', asy
2727
2727
  const fastify = Fastify()
2728
2728
  await fastify.register(compressPlugin, { global: true })
2729
2729
 
2730
- fastify.get('/', (request, reply) => {
2730
+ fastify.get('/', (_request, reply) => {
2731
2731
  reply
2732
2732
  .header('vary', 'different-header')
2733
2733
  .type('text/plain')
2734
2734
  .compress(createReadStream('./package.json'))
2735
2735
  })
2736
2736
 
2737
- fastify.get('/foo', (request, reply) => {
2737
+ fastify.get('/foo', (_request, reply) => {
2738
2738
  reply
2739
2739
  .header('vary', ['different-header', 'my-header'])
2740
2740
  .type('text/plain')
@@ -2772,14 +2772,14 @@ test('It should not add `accept-encoding` to `Vary` reply header if already pres
2772
2772
  const fastify = Fastify()
2773
2773
  await fastify.register(compressPlugin, { global: true })
2774
2774
 
2775
- fastify.get('/', (request, reply) => {
2775
+ fastify.get('/', (_request, reply) => {
2776
2776
  reply
2777
2777
  .header('vary', 'accept-encoding,different-header')
2778
2778
  .type('text/plain')
2779
2779
  .compress(createReadStream('./package.json'))
2780
2780
  })
2781
2781
 
2782
- fastify.get('/foo', (request, reply) => {
2782
+ fastify.get('/foo', (_request, reply) => {
2783
2783
  reply
2784
2784
  .header('vary', 'accept-encoding, different-header, my-header')
2785
2785
  .type('text/plain')
@@ -2817,7 +2817,7 @@ test('It should follow the `Accept-Encoding` request header encoding order', asy
2817
2817
  const fastify = Fastify()
2818
2818
  await fastify.register(compressPlugin, { global: true })
2819
2819
 
2820
- fastify.get('/', (request, reply) => {
2820
+ fastify.get('/', (_request, reply) => {
2821
2821
  reply
2822
2822
  .type('text/plain')
2823
2823
  .compress(createReadStream('./package.json'))
@@ -2846,7 +2846,7 @@ test('It should sort and follow custom `encodings` options', async (t) => {
2846
2846
  encodings: ['br', 'gzip']
2847
2847
  })
2848
2848
 
2849
- fastify.get('/', (request, reply) => {
2849
+ fastify.get('/', (_request, reply) => {
2850
2850
  reply
2851
2851
  .type('text/plain')
2852
2852
  .compress(createReadStream('./package.json'))
@@ -2875,7 +2875,7 @@ test('It should sort and prefer the order of custom `encodings` options', async
2875
2875
  encodings: ['gzip', 'deflate', 'br']
2876
2876
  })
2877
2877
 
2878
- fastify.get('/', (request, reply) => {
2878
+ fastify.get('/', (_request, reply) => {
2879
2879
  reply
2880
2880
  .type('text/plain')
2881
2881
  .compress(createReadStream('./package.json'))
@@ -2905,7 +2905,7 @@ test('It should sort and follow custom `requestEncodings` options', async (t) =>
2905
2905
  requestEncodings: ['gzip', 'br']
2906
2906
  })
2907
2907
 
2908
- fastify.get('/', (request, reply) => {
2908
+ fastify.get('/', (_request, reply) => {
2909
2909
  reply
2910
2910
  .type('text/plain')
2911
2911
  .compress(createReadStream('./package.json'))
@@ -2938,7 +2938,7 @@ describe('It should uncompress data when `Accept-Encoding` request header is mis
2938
2938
  })
2939
2939
 
2940
2940
  const json = { hello: 'world' }
2941
- fastify.get('/', (request, reply) => {
2941
+ fastify.get('/', (_request, reply) => {
2942
2942
  reply.send(zlib.deflateSync(JSON.stringify(json)))
2943
2943
  })
2944
2944
 
@@ -2964,7 +2964,7 @@ describe('It should uncompress data when `Accept-Encoding` request header is mis
2964
2964
  })
2965
2965
 
2966
2966
  const json = { hello: 'world' }
2967
- fastify.get('/', (request, reply) => {
2967
+ fastify.get('/', (_request, reply) => {
2968
2968
  reply.send(zlib.gzipSync(JSON.stringify(json)))
2969
2969
  })
2970
2970
 
@@ -2989,7 +2989,7 @@ describe('It should uncompress data when `Accept-Encoding` request header is mis
2989
2989
  })
2990
2990
 
2991
2991
  const json = { hello: 'world' }
2992
- fastify.get('/', (request, reply) => {
2992
+ fastify.get('/', (_request, reply) => {
2993
2993
  reply.send(zlib.deflateSync(JSON.stringify(json)))
2994
2994
  })
2995
2995
 
@@ -3014,7 +3014,7 @@ describe('It should uncompress data when `Accept-Encoding` request header is mis
3014
3014
  })
3015
3015
 
3016
3016
  const json = { hello: 'world' }
3017
- fastify.get('/', (request, reply) => {
3017
+ fastify.get('/', (_request, reply) => {
3018
3018
  reply.send(zlib.gzipSync(JSON.stringify(json)))
3019
3019
  })
3020
3020
 
@@ -3038,7 +3038,7 @@ describe('It should uncompress data when `Accept-Encoding` request header is mis
3038
3038
  threshold: 0
3039
3039
  })
3040
3040
 
3041
- fastify.get('/', (request, reply) => {
3041
+ fastify.get('/', (_request, reply) => {
3042
3042
  reply.send(
3043
3043
  createReadStream('./package.json')
3044
3044
  .pipe(zlib.createDeflate())
@@ -3066,7 +3066,7 @@ describe('It should uncompress data when `Accept-Encoding` request header is mis
3066
3066
  threshold: 0
3067
3067
  })
3068
3068
 
3069
- fastify.get('/', (request, reply) => {
3069
+ fastify.get('/', (_request, reply) => {
3070
3070
  reply.send(
3071
3071
  createReadStream('./package.json')
3072
3072
  .pipe(zlib.createGzip())
@@ -3095,7 +3095,7 @@ describe('It should uncompress data when `Accept-Encoding` request header is mis
3095
3095
  })
3096
3096
 
3097
3097
  const json = { hello: 'world' }
3098
- fastify.get('/', (request, reply) => {
3098
+ fastify.get('/', (_request, reply) => {
3099
3099
  reply.send(
3100
3100
  [0, 1, 2, 3, 4, 5, 6].reduce(
3101
3101
  (x) => zlib.gzipSync(x), JSON.stringify(json)
@@ -3121,13 +3121,13 @@ describe('When `onUnsupportedEncoding` is set and the `Accept-Encoding` request
3121
3121
  const fastify = Fastify()
3122
3122
  await fastify.register(compressPlugin, {
3123
3123
  global: true,
3124
- onUnsupportedEncoding: (encoding, request, reply) => {
3124
+ onUnsupportedEncoding: (encoding, _request, reply) => {
3125
3125
  reply.code(406)
3126
3126
  return JSON.stringify({ hello: encoding })
3127
3127
  }
3128
3128
  })
3129
3129
 
3130
- fastify.get('/', (request, reply) => {
3130
+ fastify.get('/', (_request, reply) => {
3131
3131
  reply
3132
3132
  .type('text/plain')
3133
3133
  .compress(createReadStream('./package.json'))
@@ -3151,13 +3151,13 @@ describe('When `onUnsupportedEncoding` is set and the `Accept-Encoding` request
3151
3151
  const fastify = Fastify()
3152
3152
  await fastify.register(compressPlugin, {
3153
3153
  global: true,
3154
- onUnsupportedEncoding: (encoding, request, reply) => {
3154
+ onUnsupportedEncoding: (_encoding, _request, reply) => {
3155
3155
  reply.code(406)
3156
3156
  throw new Error('testing error')
3157
3157
  }
3158
3158
  })
3159
3159
 
3160
- fastify.get('/', (request, reply) => {
3160
+ fastify.get('/', (_request, reply) => {
3161
3161
  reply
3162
3162
  .type('text/plain')
3163
3163
  .compress(createReadStream('./package.json'))
@@ -3212,7 +3212,7 @@ test('It should return an error when using `reply.compress()` with a missing pay
3212
3212
  const fastify = Fastify()
3213
3213
  await fastify.register(compressPlugin, { global: true })
3214
3214
 
3215
- fastify.get('/', (request, reply) => {
3215
+ fastify.get('/', (_request, reply) => {
3216
3216
  reply.compress()
3217
3217
  })
3218
3218
 
@@ -3247,7 +3247,7 @@ for (const contentType of defaultSupportedContentTypes) {
3247
3247
  const fastify = Fastify()
3248
3248
  await fastify.register(compressPlugin)
3249
3249
 
3250
- fastify.get('/', (request, reply) => {
3250
+ fastify.get('/', (_request, reply) => {
3251
3251
  reply
3252
3252
  .type(contentType)
3253
3253
  .send(createReadStream('./package.json'))
@@ -3279,7 +3279,7 @@ for (const contentType of notByDefaultSupportedContentTypes) {
3279
3279
  const fastify = Fastify()
3280
3280
  await fastify.register(compressPlugin)
3281
3281
 
3282
- fastify.get('/', (request, reply) => {
3282
+ fastify.get('/', (_request, reply) => {
3283
3283
  reply
3284
3284
  .type(contentType)
3285
3285
  .send(createReadStream('./package.json'))