@fastify/reply-from 11.0.2 → 12.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.
Files changed (97) hide show
  1. package/README.md +16 -16
  2. package/eslint.config.js +6 -0
  3. package/examples/example.js +2 -2
  4. package/index.js +6 -8
  5. package/lib/request.js +4 -4
  6. package/package.json +37 -10
  7. package/test/async-route-handler.test.js +1 -1
  8. package/test/base-get.test.js +1 -1
  9. package/test/base-path.test.js +2 -2
  10. package/test/base-querystring.test.js +1 -1
  11. package/test/core-with-path-in-base.test.js +1 -1
  12. package/test/custom-undici-instance.test.js +2 -2
  13. package/test/disable-request-logging.test.js +3 -3
  14. package/test/fastify-multipart-incompatibility.test.js +2 -2
  15. package/test/fix-GHSA-v2v2-hph8-q5xp.test.js +52 -36
  16. package/test/full-delete-http2.test.js +2 -2
  17. package/test/full-get-test.test.js +1 -1
  18. package/test/full-https-get.test.js +1 -1
  19. package/test/full-post-extended-content-type.test.js +1 -1
  20. package/test/full-post-http2.test.js +1 -1
  21. package/test/full-post-stream-core.test.js +3 -3
  22. package/test/full-post-stream.test.js +3 -3
  23. package/test/full-post.test.js +2 -2
  24. package/test/full-querystring-rewrite-option-complex.test.js +1 -1
  25. package/test/full-querystring-rewrite-option-function-request.test.js +3 -3
  26. package/test/full-querystring-rewrite-option-function.test.js +1 -1
  27. package/test/full-querystring-rewrite-option.test.js +1 -1
  28. package/test/full-querystring-rewrite-string.test.js +1 -1
  29. package/test/full-querystring-rewrite.test.js +1 -1
  30. package/test/full-querystring.test.js +1 -1
  31. package/test/full-rewrite-body-content-type.test.js +10 -7
  32. package/test/full-rewrite-body-http.test.js +2 -2
  33. package/test/full-rewrite-body-to-empty-string.test.js +2 -2
  34. package/test/full-rewrite-body-to-null.test.js +2 -2
  35. package/test/full-rewrite-body.test.js +2 -2
  36. package/test/get-upstream-http.test.js +3 -3
  37. package/test/get-upstream-undici.test.js +1 -1
  38. package/test/get-with-body.test.js +1 -1
  39. package/test/head-with-body.test.js +1 -7
  40. package/test/host-header.test.js +4 -4
  41. package/test/http-agents.test.js +1 -1
  42. package/test/http-global-agent.test.js +1 -1
  43. package/test/http-http2.test.js +2 -2
  44. package/test/http-invalid-target.test.js +1 -1
  45. package/test/http-retry.test.js +3 -3
  46. package/test/http-timeout.test.js +4 -4
  47. package/test/http2-http2.test.js +2 -2
  48. package/test/http2-https.test.js +2 -2
  49. package/test/http2-invalid-target.test.js +1 -1
  50. package/test/http2-target-crash.test.js +2 -2
  51. package/test/http2-target-multi-crash.test.js +1 -1
  52. package/test/http2-timeout-disabled.test.js +2 -2
  53. package/test/http2-timeout.test.js +4 -4
  54. package/test/https-agents.test.js +1 -1
  55. package/test/https-global-agent.test.js +1 -1
  56. package/test/method.test.js +3 -3
  57. package/test/modifyCoreObjects-false.test.js +1 -1
  58. package/test/no-body-opts-with-get.test.js +2 -2
  59. package/test/no-body-opts-with-head.test.js +2 -2
  60. package/test/no-stream-body-option.test.js +2 -2
  61. package/test/on-error.test.js +2 -2
  62. package/test/on-invalid-upstream-response.test.js +1 -1
  63. package/test/padded-body.test.js +2 -2
  64. package/test/post-formbody.test.js +1 -1
  65. package/test/post-plain-text.test.js +1 -1
  66. package/test/post-with-custom-encoded-contenttype.test.js +2 -2
  67. package/test/post-with-octet-stream.test.js +5 -5
  68. package/test/retry-on-503.test.js +4 -4
  69. package/test/retry-with-a-custom-handler.test.js +7 -7
  70. package/test/rewrite-headers-type.test.js +2 -2
  71. package/test/rewrite-headers.test.js +3 -3
  72. package/test/rewrite-request-headers-type.test.js +2 -2
  73. package/test/rewrite-request-headers.test.js +2 -2
  74. package/test/transform-body.test.js +3 -3
  75. package/test/undici-agent.test.js +2 -2
  76. package/test/undici-body.test.js +3 -3
  77. package/test/undici-chaining.test.js +3 -3
  78. package/test/undici-connect-timeout.test.js +2 -2
  79. package/test/undici-custom-dispatcher.test.js +2 -2
  80. package/test/undici-global-agent.test.js +2 -2
  81. package/test/undici-no-destroy.test.js +1 -1
  82. package/test/undici-options.test.js +2 -2
  83. package/test/undici-proxy-agent.test.js +47 -28
  84. package/test/undici-retry.test.js +3 -3
  85. package/test/undici-timeout-body-partial.test.js +1 -1
  86. package/test/undici-timeout-body.test.js +1 -1
  87. package/test/undici-timeout.test.js +2 -2
  88. package/test/undici-with-path-in-base.test.js +1 -1
  89. package/test/undici.test.js +1 -1
  90. package/test/unexpected-error.test.js +2 -2
  91. package/test/unix-http-undici-from.test.js +3 -3
  92. package/test/unix-http-undici.test.js +1 -1
  93. package/test/unix-http.test.js +1 -1
  94. package/test/unix-https-undici.test.js +1 -1
  95. package/test/unix-https.test.js +1 -1
  96. package/types/index.d.ts +10 -11
  97. package/types/index.test-d.ts +109 -108
@@ -29,7 +29,7 @@ const target = http.createServer((req, res) => {
29
29
  })
30
30
  })
31
31
 
32
- instance.post('/', (request, reply) => {
32
+ instance.post('/', (_request, reply) => {
33
33
  reply.from(`http://localhost:${target.address().port}`)
34
34
  })
35
35
 
@@ -48,7 +48,7 @@ instance.listen({ port: 0 }, (err) => {
48
48
  body: {
49
49
  hello: 'world'
50
50
  }
51
- }, (err, res, data) => {
51
+ }, (err, _res, data) => {
52
52
  t.error(err)
53
53
  t.same(data, { something: 'else' })
54
54
  })
@@ -21,7 +21,7 @@ const target = http.createServer((req, res) => {
21
21
  res.end('hello world')
22
22
  })
23
23
 
24
- instance.get('/hello', (request, reply) => {
24
+ instance.get('/hello', (_request, reply) => {
25
25
  reply.from(`http://localhost:${target.address().port}/world?a=b`, {
26
26
  queryString: { b: 'c' }
27
27
  })
@@ -9,7 +9,7 @@ const querystring = require('node:querystring')
9
9
 
10
10
  const instance = Fastify()
11
11
 
12
- instance.addHook('preHandler', (request, reply, done) => {
12
+ instance.addHook('preHandler', (request, _reply, done) => {
13
13
  request.addedVal = 'test'
14
14
  done()
15
15
  })
@@ -27,9 +27,9 @@ const target = http.createServer((req, res) => {
27
27
  res.end('hello world')
28
28
  })
29
29
 
30
- instance.get('/hello', (request, reply) => {
30
+ instance.get('/hello', (_request, reply) => {
31
31
  reply.from(`http://localhost:${target.address().port}/world?a=b`, {
32
- queryString (search, reqUrl, request) {
32
+ queryString (_search, _reqUrl, request) {
33
33
  return querystring.stringify({ q: request.addedVal })
34
34
  }
35
35
  })
@@ -22,7 +22,7 @@ const target = http.createServer((req, res) => {
22
22
  res.end('hello world')
23
23
  })
24
24
 
25
- instance.get('/hello', (request, reply) => {
25
+ instance.get('/hello', (_request, reply) => {
26
26
  reply.from(`http://localhost:${target.address().port}/world?a=b`, {
27
27
  queryString () {
28
28
  return querystring.stringify({ b: 'c' })
@@ -21,7 +21,7 @@ const target = http.createServer((req, res) => {
21
21
  res.end('hello world')
22
22
  })
23
23
 
24
- instance.get('/hello', (request, reply) => {
24
+ instance.get('/hello', (_request, reply) => {
25
25
  reply.from(`http://localhost:${target.address().port}/world`, {
26
26
  queryString: { b: 'c' }
27
27
  })
@@ -21,7 +21,7 @@ const target = http.createServer((req, res) => {
21
21
  res.end('hello world')
22
22
  })
23
23
 
24
- instance.get('/hello', (request, reply) => {
24
+ instance.get('/hello', (_request, reply) => {
25
25
  reply.from(`http://localhost:${target.address().port}/world?b=c`)
26
26
  })
27
27
 
@@ -21,7 +21,7 @@ const target = http.createServer((req, res) => {
21
21
  res.end('hello world')
22
22
  })
23
23
 
24
- instance.get('/hello', (request, reply) => {
24
+ instance.get('/hello', (_request, reply) => {
25
25
  reply.from(`http://localhost:${target.address().port}/world`)
26
26
  })
27
27
 
@@ -21,7 +21,7 @@ const target = http.createServer((req, res) => {
21
21
  res.end('hello world')
22
22
  })
23
23
 
24
- instance.get('/hello', (request, reply) => {
24
+ instance.get('/hello', (_request, reply) => {
25
25
  reply.from(`http://localhost:${target.address().port}/world`)
26
26
  })
27
27
 
@@ -2,15 +2,17 @@
2
2
 
3
3
  const t = require('tap')
4
4
  const Fastify = require('fastify')
5
- const From = require('..')
5
+ const fastifyReplyFrom = require('..')
6
6
  const http = require('node:http')
7
7
  const get = require('simple-get').concat
8
- const msgpack = require('msgpack5')()
9
8
 
10
9
  const instance = Fastify()
11
- instance.register(From)
10
+ instance.register(fastifyReplyFrom)
12
11
 
13
- t.plan(8)
12
+ const payload = { hello: 'world' }
13
+ const msgPackPayload = Buffer.from([0x81, 0xa5, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0xa5, 0x77, 0x6f, 0x72, 0x6c, 0x64])
14
+
15
+ t.plan(9)
14
16
  t.teardown(instance.close.bind(instance))
15
17
 
16
18
  const target = http.createServer((req, res) => {
@@ -22,7 +24,7 @@ const target = http.createServer((req, res) => {
22
24
  data.push(d)
23
25
  })
24
26
  req.on('end', () => {
25
- t.same(msgpack.decode(Buffer.concat(data)), { hello: 'world' })
27
+ t.same(Buffer.concat(data), msgPackPayload)
26
28
  res.statusCode = 200
27
29
  res.setHeader('content-type', 'application/json')
28
30
  res.end(JSON.stringify({ something: 'else' }))
@@ -30,9 +32,10 @@ const target = http.createServer((req, res) => {
30
32
  })
31
33
 
32
34
  instance.post('/', (request, reply) => {
35
+ t.same(request.body, payload)
33
36
  reply.from(`http://localhost:${target.address().port}`, {
34
37
  contentType: 'application/msgpack',
35
- body: msgpack.encode(request.body)
38
+ body: msgPackPayload
36
39
  })
37
40
  })
38
41
 
@@ -51,7 +54,7 @@ instance.listen({ port: 0 }, (err) => {
51
54
  body: {
52
55
  hello: 'world'
53
56
  }
54
- }, (err, res, data) => {
57
+ }, (err, _res, data) => {
55
58
  t.error(err)
56
59
  t.same(data, { something: 'else' })
57
60
  })
@@ -32,7 +32,7 @@ const target = http.createServer((req, res) => {
32
32
  })
33
33
  })
34
34
 
35
- instance.post('/', (request, reply) => {
35
+ instance.post('/', (_request, reply) => {
36
36
  reply.from(`http://localhost:${target.address().port}`, {
37
37
  body: {
38
38
  something: 'else'
@@ -55,7 +55,7 @@ instance.listen({ port: 0 }, (err) => {
55
55
  body: {
56
56
  hello: 'world'
57
57
  }
58
- }, (err, res, data) => {
58
+ }, (err, _res, data) => {
59
59
  t.error(err)
60
60
  t.same(data, { hello: 'fastify' })
61
61
  })
@@ -32,7 +32,7 @@ const target = http.createServer((req, res) => {
32
32
  })
33
33
  })
34
34
 
35
- instance.post('/', (request, reply) => {
35
+ instance.post('/', (_request, reply) => {
36
36
  reply.from(`http://localhost:${target.address().port}`, {
37
37
  body: ''
38
38
  })
@@ -53,7 +53,7 @@ instance.listen({ port: 0 }, (err) => {
53
53
  body: {
54
54
  hello: 'world'
55
55
  }
56
- }, (err, res, data) => {
56
+ }, (err, _res, data) => {
57
57
  t.error(err)
58
58
  t.same(data, { hello: 'fastify' })
59
59
  })
@@ -32,7 +32,7 @@ const target = http.createServer((req, res) => {
32
32
  })
33
33
  })
34
34
 
35
- instance.post('/', (request, reply) => {
35
+ instance.post('/', (_request, reply) => {
36
36
  reply.from(`http://localhost:${target.address().port}`, {
37
37
  body: null
38
38
  })
@@ -53,7 +53,7 @@ instance.listen({ port: 0 }, (err) => {
53
53
  body: {
54
54
  hello: 'world'
55
55
  }
56
- }, (err, res, data) => {
56
+ }, (err, _res, data) => {
57
57
  t.error(err)
58
58
  t.same(data, { hello: 'fastify' })
59
59
  })
@@ -30,7 +30,7 @@ const target = http.createServer((req, res) => {
30
30
  })
31
31
  })
32
32
 
33
- instance.post('/', (request, reply) => {
33
+ instance.post('/', (_request, reply) => {
34
34
  reply.from(`http://localhost:${target.address().port}`, {
35
35
  body: {
36
36
  something: 'else'
@@ -53,7 +53,7 @@ instance.listen({ port: 0 }, (err) => {
53
53
  body: {
54
54
  hello: 'world'
55
55
  }
56
- }, (err, res, data) => {
56
+ }, (err, _res, data) => {
57
57
  t.error(err)
58
58
  t.same(data, { hello: 'fastify' })
59
59
  })
@@ -29,16 +29,16 @@ const target = http.createServer((req, res) => {
29
29
  res.end(req.headers.host)
30
30
  })
31
31
 
32
- instance.get('/test', (request, reply) => {
32
+ instance.get('/test', (_request, reply) => {
33
33
  reply.from('/test', {
34
- getUpstream: (req, base) => {
34
+ getUpstream: (_req, base) => {
35
35
  t.pass('getUpstream called')
36
36
  return `${base}:${target.address().port}`
37
37
  }
38
38
  })
39
39
  })
40
40
 
41
- instanceWithoutBase.get('/test2', (request, reply) => {
41
+ instanceWithoutBase.get('/test2', (_request, reply) => {
42
42
  reply.from('/test2', {
43
43
  getUpstream: () => {
44
44
  t.pass('getUpstream called')
@@ -20,7 +20,7 @@ const target = http.createServer((req, res) => {
20
20
  res.end(req.headers.host)
21
21
  })
22
22
 
23
- instance.get('/test', (request, reply) => {
23
+ instance.get('/test', (_request, reply) => {
24
24
  reply.from('/test', {
25
25
  getUpstream: () => {
26
26
  t.pass('getUpstream called')
@@ -22,7 +22,7 @@ const target = http.createServer((req, res) => {
22
22
  res.end('hello world')
23
23
  })
24
24
 
25
- instance.get('/', (request, reply) => {
25
+ instance.get('/', (_request, reply) => {
26
26
  reply.from()
27
27
  })
28
28
 
@@ -5,12 +5,6 @@ const Fastify = require('fastify')
5
5
  const From = require('..')
6
6
  const http = require('node:http')
7
7
  const get = require('simple-get').concat
8
- const semver = require('semver')
9
-
10
- if (semver.gte(process.version, '20.2.0')) {
11
- t.comment('skip this test on node >= 20.2.0 as it is current broken')
12
- process.exit(0)
13
- }
14
8
 
15
9
  const instance = Fastify()
16
10
 
@@ -29,7 +23,7 @@ const target = http.createServer((req, res) => {
29
23
  res.end('hello world')
30
24
  })
31
25
 
32
- instance.head('/', (request, reply) => {
26
+ instance.head('/', (_request, reply) => {
33
27
  t.pass('head received')
34
28
  reply.from()
35
29
  })
@@ -12,12 +12,12 @@ test('hostname', async (t) => {
12
12
 
13
13
  nock('http://httpbin.org')
14
14
  .get('/ip')
15
- .reply(200, function (uri, requestBody) {
15
+ .reply(200, function () {
16
16
  t.equal(this.req.headers.host, 'httpbin.org')
17
17
  return { origin: '127.0.0.1' }
18
18
  })
19
19
 
20
- instance.get('*', (request, reply) => {
20
+ instance.get('*', (_request, reply) => {
21
21
  reply.from(null, {
22
22
  rewriteRequestHeaders: (originalReq, headers) => {
23
23
  t.equal(headers.host, 'httpbin.org')
@@ -48,7 +48,7 @@ test('hostname and port', async (t) => {
48
48
 
49
49
  nock('http://httpbin.org:8080')
50
50
  .get('/ip')
51
- .reply(200, function (uri, requestBody) {
51
+ .reply(200, function () {
52
52
  t.equal(this.req.headers.host, 'httpbin.org:8080')
53
53
  return { origin: '127.0.0.1' }
54
54
  })
@@ -58,7 +58,7 @@ test('hostname and port', async (t) => {
58
58
  http: true
59
59
  })
60
60
 
61
- instance.get('*', (request, reply) => {
61
+ instance.get('*', (_request, reply) => {
62
62
  reply.from()
63
63
  })
64
64
 
@@ -22,7 +22,7 @@ const target = http.createServer((req, res) => {
22
22
  res.end('hello world')
23
23
  })
24
24
 
25
- instance.get('/', (request, reply) => {
25
+ instance.get('/', (_request, reply) => {
26
26
  reply.from()
27
27
  })
28
28
 
@@ -12,7 +12,7 @@ test('http global agent is used, but not destroyed', async (t) => {
12
12
  }
13
13
  const instance = Fastify()
14
14
  t.teardown(instance.close.bind(instance))
15
- instance.get('/', (request, reply) => {
15
+ instance.get('/', (_request, reply) => {
16
16
  reply.from()
17
17
  })
18
18
 
@@ -14,14 +14,14 @@ test('http -> http2', async (t) => {
14
14
  http2: true
15
15
  })
16
16
 
17
- target.get('/', (request, reply) => {
17
+ target.get('/', (_request, reply) => {
18
18
  t.pass('request proxied')
19
19
  reply.code(404).header('x-my-header', 'hello!').send({
20
20
  hello: 'world'
21
21
  })
22
22
  })
23
23
 
24
- instance.get('/', (request, reply) => {
24
+ instance.get('/', (_request, reply) => {
25
25
  reply.from()
26
26
  })
27
27
 
@@ -10,7 +10,7 @@ test('http invalid target', async (t) => {
10
10
 
11
11
  t.teardown(instance.close.bind(instance))
12
12
 
13
- instance.get('/', (request, reply) => {
13
+ instance.get('/', (_request, reply) => {
14
14
  reply.from()
15
15
  })
16
16
  instance.register(From, {
@@ -29,7 +29,7 @@ test('Will retry', async function (t) {
29
29
 
30
30
  instance.register(From, { http: true })
31
31
 
32
- instance.get('/', (request, reply) => {
32
+ instance.get('/', (_request, reply) => {
33
33
  reply.from(`http://localhost:${target.address().port}/`, {
34
34
  retriesCount: 1,
35
35
  onError: (reply, { error }) => {
@@ -56,7 +56,7 @@ test('will not retry', async function (t) {
56
56
 
57
57
  instance.register(From, { http: true })
58
58
 
59
- instance.get('/', (request, reply) => {
59
+ instance.get('/', (_request, reply) => {
60
60
  reply.from(`http://localhost:${target.address().port}/`, {
61
61
  retriesCount: 0,
62
62
  onError: (reply, { error }) => {
@@ -87,7 +87,7 @@ test('will not retry unsupported method', async function (t) {
87
87
 
88
88
  instance.register(From, { http: true, retryMethods: ['DELETE'] })
89
89
 
90
- instance.get('/', (request, reply) => {
90
+ instance.get('/', (_request, reply) => {
91
91
  reply.from(`http://localhost:${target.address().port}/`, {
92
92
  retriesCount: 1,
93
93
  onError: (reply, { error }) => {
@@ -12,7 +12,7 @@ test('http request timeout', async (t) => {
12
12
  const target = Fastify()
13
13
  t.teardown(target.close.bind(target))
14
14
 
15
- target.get('/', (request, reply) => {
15
+ target.get('/', (_request, reply) => {
16
16
  t.pass('request arrives')
17
17
 
18
18
  clock.setTimeout(() => {
@@ -28,7 +28,7 @@ test('http request timeout', async (t) => {
28
28
 
29
29
  instance.register(From, { http: { requestOptions: { timeout: 100 } } })
30
30
 
31
- instance.get('/', (request, reply) => {
31
+ instance.get('/', (_request, reply) => {
32
32
  reply.from(`http://localhost:${target.server.address().port}/`)
33
33
  })
34
34
 
@@ -56,7 +56,7 @@ test('http sse removes timeout test', async (t) => {
56
56
  const target = Fastify()
57
57
  t.teardown(target.close.bind(target))
58
58
 
59
- target.get('/', (request, reply) => {
59
+ target.get('/', (_request, reply) => {
60
60
  t.pass('request arrives')
61
61
 
62
62
  reply.header('content-type', 'text/event-stream').status(200).send('hello world')
@@ -69,7 +69,7 @@ test('http sse removes timeout test', async (t) => {
69
69
 
70
70
  instance.register(From, { http: { requestOptions: { timeout: 100 } } })
71
71
 
72
- instance.get('/', (request, reply) => {
72
+ instance.get('/', (_request, reply) => {
73
73
  reply.from(`http://localhost:${target.server.address().port}/`)
74
74
  })
75
75
 
@@ -23,14 +23,14 @@ t.test('http2 -> http2', async (t) => {
23
23
  http2: true
24
24
  })
25
25
 
26
- target.get('/', (request, reply) => {
26
+ target.get('/', (_request, reply) => {
27
27
  t.pass('request proxied')
28
28
  reply.code(404).header('x-my-header', 'hello!').send({
29
29
  hello: 'world'
30
30
  })
31
31
  })
32
32
 
33
- instance.get('/', (request, reply) => {
33
+ instance.get('/', (_request, reply) => {
34
34
  reply.from()
35
35
  })
36
36
 
@@ -25,14 +25,14 @@ const target = Fastify({
25
25
  https: certs
26
26
  })
27
27
 
28
- target.get('/', (request, reply) => {
28
+ target.get('/', (_request, reply) => {
29
29
  t.pass('request proxied')
30
30
  reply.code(404).header('x-my-header', 'hello!').send({
31
31
  hello: 'world'
32
32
  })
33
33
  })
34
34
 
35
- instance.get('/', (request, reply) => {
35
+ instance.get('/', (_request, reply) => {
36
36
  reply.from()
37
37
  })
38
38
 
@@ -10,7 +10,7 @@ test('http2 invalid target', async (t) => {
10
10
 
11
11
  t.teardown(instance.close.bind(instance))
12
12
 
13
- instance.get('/', (request, reply) => {
13
+ instance.get('/', (_request, reply) => {
14
14
  reply.from()
15
15
  })
16
16
  instance.register(From, {
@@ -14,14 +14,14 @@ test('http -> http2 crash', async (t) => {
14
14
  http2: true
15
15
  })
16
16
 
17
- target.get('/', (request, reply) => {
17
+ target.get('/', (_request, reply) => {
18
18
  t.pass('request proxied')
19
19
  reply.code(200).send({
20
20
  hello: 'world'
21
21
  })
22
22
  })
23
23
 
24
- instance.get('/', (request, reply) => {
24
+ instance.get('/', (_request, reply) => {
25
25
  reply.from()
26
26
  })
27
27
 
@@ -10,7 +10,7 @@ test('http -> http2 crash multiple times', async (t) => {
10
10
 
11
11
  t.teardown(instance.close.bind(instance))
12
12
 
13
- instance.get('/', (request, reply) => {
13
+ instance.get('/', (_request, reply) => {
14
14
  reply.from()
15
15
  })
16
16
 
@@ -23,7 +23,7 @@ test('http2 request timeout disabled', async (t) => {
23
23
  http2: { requestTimeout: 0, sessionTimeout: 16000 }
24
24
  })
25
25
 
26
- instance.get('/', (request, reply) => {
26
+ instance.get('/', (_request, reply) => {
27
27
  reply.from(`http://localhost:${target.server.address().port}/`)
28
28
  })
29
29
 
@@ -59,7 +59,7 @@ test('http2 session timeout disabled', async (t) => {
59
59
  http2: { requestTimeout: 0, sessionTimeout: 0 }
60
60
  })
61
61
 
62
- instance.get('/', (request, reply) => {
62
+ instance.get('/', (_request, reply) => {
63
63
  reply.from(`http://localhost:${target.server.address().port}/`)
64
64
  })
65
65
 
@@ -23,7 +23,7 @@ test('http2 request timeout', async (t) => {
23
23
  http2: { requestTimeout: 100, sessionTimeout: 6000 }
24
24
  })
25
25
 
26
- instance.get('/', (request, reply) => {
26
+ instance.get('/', (_request, reply) => {
27
27
  reply.from(`http://localhost:${target.server.address().port}/`)
28
28
  })
29
29
 
@@ -67,7 +67,7 @@ test('http2 session timeout', async (t) => {
67
67
  http2: { sessionTimeout: 100 }
68
68
  })
69
69
 
70
- instance.get('/', (request, reply) => {
70
+ instance.get('/', (_request, reply) => {
71
71
  reply.from(`http://localhost:${target.server.address().port}/`)
72
72
  })
73
73
 
@@ -96,7 +96,7 @@ test('http2 session timeout', async (t) => {
96
96
  test('http2 sse removes request and session timeout test', async (t) => {
97
97
  const target = Fastify({ http2: true, sessionTimeout: 0 })
98
98
 
99
- target.get('/', (request, reply) => {
99
+ target.get('/', (_request, reply) => {
100
100
  t.pass('request arrives')
101
101
 
102
102
  reply.status(200).header('content-type', 'text/event-stream').send('hello world')
@@ -111,7 +111,7 @@ test('http2 sse removes request and session timeout test', async (t) => {
111
111
  http2: { sessionTimeout: 100 }
112
112
  })
113
113
 
114
- instance.get('/', (request, reply) => {
114
+ instance.get('/', (_request, reply) => {
115
115
  reply.from(`http://localhost:${target.server.address().port}/`)
116
116
  })
117
117
 
@@ -31,7 +31,7 @@ const target = https.createServer(certs, (req, res) => {
31
31
  res.end('hello world')
32
32
  })
33
33
 
34
- instance.get('/', (request, reply) => {
34
+ instance.get('/', (_request, reply) => {
35
35
  reply.from()
36
36
  })
37
37
 
@@ -21,7 +21,7 @@ test('https global agent is used, but not destroyed', async (t) => {
21
21
  https: certs
22
22
  })
23
23
  t.teardown(instance.close.bind(instance))
24
- instance.get('/', (request, reply) => {
24
+ instance.get('/', (_request, reply) => {
25
25
  reply.from()
26
26
  })
27
27
 
@@ -33,7 +33,7 @@ const target = http.createServer((req, res) => {
33
33
  })
34
34
  })
35
35
 
36
- instance.patch('/', (request, reply) => {
36
+ instance.patch('/', (_request, reply) => {
37
37
  reply.from(`http://localhost:${target.address().port}`, { method: 'POST' })
38
38
  })
39
39
 
@@ -42,7 +42,7 @@ t.teardown(target.close.bind(target))
42
42
  target.listen({ port: 0 }, (err) => {
43
43
  t.error(err)
44
44
 
45
- instance.addContentTypeParser('application/json', function (req, payload, done) {
45
+ instance.addContentTypeParser('application/json', function (_req, payload, done) {
46
46
  done(null, payload)
47
47
  })
48
48
 
@@ -61,7 +61,7 @@ target.listen({ port: 0 }, (err) => {
61
61
  'content-type': 'application/json'
62
62
  },
63
63
  body: bodyString
64
- }, (err, res, data) => {
64
+ }, (err, _res, data) => {
65
65
  t.error(err)
66
66
  const parsed = JSON.parse(data)
67
67
  t.same(parsed, { something: 'else' })
@@ -21,7 +21,7 @@ const target = http.createServer((req, res) => {
21
21
  res.end('hello world')
22
22
  })
23
23
 
24
- instance.get('/', (request, reply) => {
24
+ instance.get('/', (_request, reply) => {
25
25
  reply.from()
26
26
  })
27
27
 
@@ -11,12 +11,12 @@ const instance = Fastify()
11
11
  t.plan(6)
12
12
  t.teardown(instance.close.bind(instance))
13
13
 
14
- const target = http.createServer((req, res) => {
14
+ const target = http.createServer((_req, res) => {
15
15
  t.fail('this should never get called')
16
16
  res.end('hello world')
17
17
  })
18
18
 
19
- instance.get('/', (request, reply) => {
19
+ instance.get('/', (_request, reply) => {
20
20
  try {
21
21
  reply.from(null, { body: 'this is the new body' })
22
22
  } catch (e) {
@@ -11,12 +11,12 @@ const instance = Fastify()
11
11
  t.plan(7)
12
12
  t.teardown(instance.close.bind(instance))
13
13
 
14
- const target = http.createServer((req, res) => {
14
+ const target = http.createServer((_req, res) => {
15
15
  t.fail('this should never get called')
16
16
  res.end('hello world')
17
17
  })
18
18
 
19
- instance.head('/', (request, reply) => {
19
+ instance.head('/', (_request, reply) => {
20
20
  try {
21
21
  reply.from(null, { body: 'this is the new body' })
22
22
  } catch (e) {