fastify 3.25.3 → 3.27.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 (60) hide show
  1. package/LICENSE +1 -1
  2. package/build/build-validation.js +2 -0
  3. package/docs/Guides/Ecosystem.md +2 -1
  4. package/docs/Guides/Index.md +2 -0
  5. package/docs/Guides/Prototype-Poisoning.md +391 -0
  6. package/docs/Guides/Recommendations.md +1 -1
  7. package/docs/Reference/ContentTypeParser.md +4 -1
  8. package/docs/Reference/Plugins.md +4 -4
  9. package/docs/Reference/Request.md +3 -0
  10. package/docs/Reference/Server.md +52 -2
  11. package/docs/Reference/TypeScript.md +1 -1
  12. package/docs/Reference/Validation-and-Serialization.md +4 -1
  13. package/fastify.d.ts +3 -1
  14. package/fastify.js +41 -21
  15. package/lib/decorate.js +2 -2
  16. package/lib/errors.js +6 -1
  17. package/lib/noop-set.js +10 -0
  18. package/lib/pluginUtils.js +5 -0
  19. package/lib/reply.js +21 -11
  20. package/lib/route.js +34 -1
  21. package/lib/schema-controller.js +1 -1
  22. package/lib/server.js +1 -1
  23. package/lib/symbols.js +3 -1
  24. package/package.json +16 -17
  25. package/test/404s.test.js +25 -1
  26. package/test/async-await.test.js +3 -3
  27. package/test/bundler/esbuild/bundler-test.js +31 -0
  28. package/test/bundler/esbuild/package.json +10 -0
  29. package/test/bundler/esbuild/src/fail-plugin-version.js +12 -0
  30. package/test/bundler/esbuild/src/index.js +7 -0
  31. package/test/bundler/webpack/bundler-test.js +15 -4
  32. package/test/bundler/webpack/src/fail-plugin-version.js +1 -3
  33. package/test/bundler/webpack/src/index.js +1 -3
  34. package/test/close.test.js +39 -1
  35. package/test/context-config.test.js +4 -4
  36. package/test/custom-parser.test.js +30 -31
  37. package/test/inject.test.js +1 -1
  38. package/test/internals/all.test.js +2 -2
  39. package/test/internals/contentTypeParser.test.js +4 -4
  40. package/test/internals/handleRequest.test.js +8 -8
  41. package/test/internals/logger.test.js +1 -1
  42. package/test/logger.test.js +18 -18
  43. package/test/maxRequestsPerSocket.test.js +2 -2
  44. package/test/noop-set.test.js +19 -0
  45. package/test/plugin.name.display.js +10 -0
  46. package/test/plugin.test.js +18 -0
  47. package/test/route.test.js +12 -0
  48. package/test/schema-serialization.test.js +41 -0
  49. package/test/skip-reply-send.test.js +7 -7
  50. package/test/trust-proxy.test.js +1 -1
  51. package/test/types/fastify.test-d.ts +18 -0
  52. package/test/types/hooks.test-d.ts +34 -6
  53. package/test/types/instance.test-d.ts +26 -1
  54. package/test/validation-error-handling.test.js +1 -1
  55. package/test/versioned-routes.test.js +28 -4
  56. package/types/.eslintrc.json +1 -1
  57. package/types/hooks.d.ts +24 -20
  58. package/types/instance.d.ts +13 -1
  59. package/types/register.d.ts +1 -1
  60. package/types/schema.d.ts +14 -0
@@ -215,7 +215,7 @@ t.test('Current opened connection should continue to work after closing and retu
215
215
  t.error(err)
216
216
 
217
217
  const port = fastify.server.address().port
218
- const client = net.createConnection({ port: port }, () => {
218
+ const client = net.createConnection({ port }, () => {
219
219
  client.write('GET / HTTP/1.1\r\n\r\n')
220
220
 
221
221
  client.once('data', data => {
@@ -291,3 +291,41 @@ test('Cannot be reopened the closed server has listen callback', async t => {
291
291
  t.ok(err)
292
292
  })
293
293
  })
294
+
295
+ test('shutsdown while keep-alive connections are active (non-async)', t => {
296
+ t.plan(5)
297
+
298
+ const timeoutTime = 2 * 60 * 1000
299
+ const fastify = Fastify({ forceCloseConnections: true })
300
+
301
+ fastify.server.setTimeout(timeoutTime)
302
+ fastify.server.keepAliveTimeout = timeoutTime
303
+
304
+ fastify.get('/', (req, reply) => {
305
+ reply.send({ hello: 'world' })
306
+ })
307
+
308
+ fastify.listen(0, (err, address) => {
309
+ t.error(err)
310
+
311
+ const client = new Client(
312
+ 'http://localhost:' + fastify.server.address().port,
313
+ { keepAliveTimeout: 1 * 60 * 1000 }
314
+ )
315
+ client.request({ path: '/', method: 'GET' }, (err, response) => {
316
+ t.error(err)
317
+ t.equal(client.closed, false)
318
+
319
+ fastify.close((err) => {
320
+ t.error(err)
321
+
322
+ // Due to the nature of the way we reap these keep-alive connections,
323
+ // there hasn't been enough time before the server fully closed in order
324
+ // for the client to have seen the socket get destroyed. The mere fact
325
+ // that we have reached this callback is enough indication that the
326
+ // feature being tested works as designed.
327
+ t.equal(client.closed, false)
328
+ })
329
+ })
330
+ })
331
+ })
@@ -29,7 +29,7 @@ test('config', t => {
29
29
  method: 'GET',
30
30
  url: '/route',
31
31
  schema: schema.schema,
32
- handler: handler,
32
+ handler,
33
33
  config: Object.assign({}, schema.config)
34
34
  })
35
35
 
@@ -37,7 +37,7 @@ test('config', t => {
37
37
  method: 'GET',
38
38
  url: '/no-config',
39
39
  schema: schema.schema,
40
- handler: handler
40
+ handler
41
41
  })
42
42
 
43
43
  fastify.inject({
@@ -81,7 +81,7 @@ test('config with exposeHeadRoutes', t => {
81
81
  method: 'GET',
82
82
  url: '/route',
83
83
  schema: schema.schema,
84
- handler: handler,
84
+ handler,
85
85
  config: Object.assign({}, schema.config)
86
86
  })
87
87
 
@@ -89,7 +89,7 @@ test('config with exposeHeadRoutes', t => {
89
89
  method: 'GET',
90
90
  url: '/no-config',
91
91
  schema: schema.schema,
92
- handler: handler
92
+ handler
93
93
  })
94
94
 
95
95
  fastify.inject({
@@ -1314,9 +1314,10 @@ test('contentTypeParser should add a custom parser with RegExp value', t => {
1314
1314
  })
1315
1315
  })
1316
1316
 
1317
- test('contentTypeParser should add multiple custom parsers with RegExp values', t => {
1318
- t.plan(10)
1317
+ test('contentTypeParser should add multiple custom parsers with RegExp values', async t => {
1318
+ t.plan(6)
1319
1319
  const fastify = Fastify()
1320
+ t.teardown(fastify.close.bind(fastify))
1320
1321
 
1321
1322
  fastify.post('/', (req, reply) => {
1322
1323
  reply.send(req.body)
@@ -1340,48 +1341,46 @@ test('contentTypeParser should add multiple custom parsers with RegExp values',
1340
1341
  })
1341
1342
  })
1342
1343
 
1343
- fastify.listen(0, err => {
1344
- t.error(err)
1344
+ await fastify.ready()
1345
1345
 
1346
- sget({
1346
+ {
1347
+ const response = await fastify.inject({
1347
1348
  method: 'POST',
1348
- url: 'http://localhost:' + fastify.server.address().port,
1349
- body: '{"hello":"world"}',
1349
+ path: '/',
1350
+ payload: '{"hello":"world"}',
1350
1351
  headers: {
1351
1352
  'Content-Type': 'application/vnd.hello+json'
1352
1353
  }
1353
- }, (err, response, body) => {
1354
- t.error(err)
1355
- t.equal(response.statusCode, 200)
1356
- t.same(body.toString(), JSON.stringify({ hello: 'world' }))
1357
1354
  })
1355
+ t.equal(response.statusCode, 200)
1356
+ t.same(response.payload.toString(), '{"hello":"world"}')
1357
+ }
1358
1358
 
1359
- sget({
1359
+ {
1360
+ const response = await fastify.inject({
1360
1361
  method: 'POST',
1361
- url: 'http://localhost:' + fastify.server.address().port,
1362
- body: '{"hello":"world"}',
1362
+ path: '/',
1363
+ payload: '{"hello":"world"}',
1363
1364
  headers: {
1364
1365
  'Content-Type': 'application/test+xml'
1365
1366
  }
1366
- }, (err, response, body) => {
1367
- t.error(err)
1368
- t.equal(response.statusCode, 200)
1369
- t.same(body.toString(), 'xml')
1370
1367
  })
1368
+ t.equal(response.statusCode, 200)
1369
+ t.same(response.payload.toString(), 'xml')
1370
+ }
1371
1371
 
1372
- sget({
1373
- method: 'POST',
1374
- url: 'http://localhost:' + fastify.server.address().port,
1375
- body: 'abcdefg',
1376
- headers: {
1377
- 'Content-Type': 'application/+myExtension'
1378
- }
1379
- }, (err, response, body) => {
1380
- t.error(err)
1381
- t.equal(response.statusCode, 200)
1382
- t.same(body.toString(), 'abcdefgmyExtension')
1383
- fastify.close()
1384
- })
1372
+ await fastify.inject({
1373
+ method: 'POST',
1374
+ path: '/',
1375
+ payload: 'abcdefg',
1376
+ headers: {
1377
+ 'Content-Type': 'application/+myExtension'
1378
+ }
1379
+ }).then((response) => {
1380
+ t.equal(response.statusCode, 200)
1381
+ t.same(response.payload.toString(), 'abcdefgmyExtension')
1382
+ }).catch((err) => {
1383
+ t.error(err)
1385
1384
  })
1386
1385
  })
1387
1386
 
@@ -186,7 +186,7 @@ test('inject post request', t => {
186
186
  fastify.inject({
187
187
  method: 'POST',
188
188
  url: '/',
189
- payload: payload
189
+ payload
190
190
  }, (err, res) => {
191
191
  t.error(err)
192
192
  t.same(payload, JSON.parse(res.payload))
@@ -19,7 +19,7 @@ test('fastify.all should add all the methods to the same url', t => {
19
19
  function injectRequest (method) {
20
20
  const options = {
21
21
  url: '/',
22
- method: method
22
+ method
23
23
  }
24
24
 
25
25
  if (method === 'POST' || method === 'PUT' || method === 'PATCH') {
@@ -29,7 +29,7 @@ test('fastify.all should add all the methods to the same url', t => {
29
29
  fastify.inject(options, (err, res) => {
30
30
  t.error(err)
31
31
  const payload = JSON.parse(res.payload)
32
- t.same(payload, { method: method })
32
+ t.same(payload, { method })
33
33
  })
34
34
  }
35
35
  })
@@ -32,8 +32,8 @@ test('rawBody function', t => {
32
32
 
33
33
  res.log = { error: () => { }, info: () => { } }
34
34
  const context = {
35
- Reply: Reply,
36
- Request: Request,
35
+ Reply,
36
+ Request,
37
37
  preHandler: [],
38
38
  onSend: [],
39
39
  _parserOptions: {
@@ -85,8 +85,8 @@ test('Should support Webpack and faux modules', t => {
85
85
 
86
86
  res.log = { error: () => { }, info: () => { } }
87
87
  const context = {
88
- Reply: Reply,
89
- Request: Request,
88
+ Reply,
89
+ Request,
90
90
  preHandler: [],
91
91
  onSend: [],
92
92
  _parserOptions: {
@@ -62,8 +62,8 @@ test('handler function - invalid schema', t => {
62
62
  }
63
63
  },
64
64
  handler: () => {},
65
- Reply: Reply,
66
- Request: Request,
65
+ Reply,
66
+ Request,
67
67
  preValidation: [],
68
68
  preHandler: [],
69
69
  onSend: [],
@@ -93,8 +93,8 @@ test('handler function - reply', t => {
93
93
  reply.code(204)
94
94
  reply.send(undefined)
95
95
  },
96
- Reply: Reply,
97
- Request: Request,
96
+ Reply,
97
+ Request,
98
98
  preValidation: [],
99
99
  preHandler: [],
100
100
  onSend: [],
@@ -123,8 +123,8 @@ test('handler function - preValidationCallback with finished response', t => {
123
123
  t.fail()
124
124
  reply.send(undefined)
125
125
  },
126
- Reply: Reply,
127
- Request: Request,
126
+ Reply,
127
+ Request,
128
128
  preValidation: null,
129
129
  preHandler: [],
130
130
  onSend: [],
@@ -150,8 +150,8 @@ test('handler function - preValidationCallback with finished response (< v12.9.0
150
150
  t.fail()
151
151
  reply.send(undefined)
152
152
  },
153
- Reply: Reply,
154
- Request: Request,
153
+ Reply,
154
+ Request,
155
155
  preValidation: null,
156
156
  preHandler: [],
157
157
  onSend: [],
@@ -103,7 +103,7 @@ test('The logger should error if both stream and file destination are given', t
103
103
  Fastify({
104
104
  logger: {
105
105
  level: 'info',
106
- stream: stream,
106
+ stream,
107
107
  file: '/test'
108
108
  }
109
109
  })
@@ -37,7 +37,7 @@ test('defaults to info level', t => {
37
37
  try {
38
38
  fastify = Fastify({
39
39
  logger: {
40
- stream: stream
40
+ stream
41
41
  }
42
42
  })
43
43
  } catch (e) {
@@ -85,7 +85,7 @@ test('test log stream', t => {
85
85
  try {
86
86
  fastify = Fastify({
87
87
  logger: {
88
- stream: stream,
88
+ stream,
89
89
  level: 'info'
90
90
  }
91
91
  })
@@ -132,7 +132,7 @@ test('test error log stream', t => {
132
132
  try {
133
133
  fastify = Fastify({
134
134
  logger: {
135
- stream: stream,
135
+ stream,
136
136
  level: 'info'
137
137
  }
138
138
  })
@@ -182,7 +182,7 @@ test('can use external logger instance', t => {
182
182
 
183
183
  const logger = require('pino')(splitStream)
184
184
 
185
- const localFastify = Fastify({ logger: logger })
185
+ const localFastify = Fastify({ logger })
186
186
 
187
187
  localFastify.get('/foo', function (req, reply) {
188
188
  t.ok(req.log)
@@ -226,7 +226,7 @@ test('can use external logger instance with custom serializer', t => {
226
226
  }, splitStream)
227
227
 
228
228
  const localFastify = Fastify({
229
- logger: logger
229
+ logger
230
230
  })
231
231
 
232
232
  localFastify.get('/foo', function (req, reply) {
@@ -253,7 +253,7 @@ test('expose the logger', t => {
253
253
  try {
254
254
  fastify = Fastify({
255
255
  logger: {
256
- stream: stream,
256
+ stream,
257
257
  level: 'info'
258
258
  }
259
259
  })
@@ -271,7 +271,7 @@ test('The request id header key can be customized', t => {
271
271
 
272
272
  const stream = split(JSON.parse)
273
273
  const fastify = Fastify({
274
- logger: { stream: stream, level: 'info' },
274
+ logger: { stream, level: 'info' },
275
275
  requestIdHeader: 'my-custom-request-id'
276
276
  })
277
277
  t.teardown(() => fastify.close())
@@ -316,7 +316,7 @@ test('The request id header key can be customized along with a custom id generat
316
316
 
317
317
  const stream = split(JSON.parse)
318
318
  const fastify = Fastify({
319
- logger: { stream: stream, level: 'info' },
319
+ logger: { stream, level: 'info' },
320
320
  requestIdHeader: 'my-custom-request-id',
321
321
  genReqId (req) {
322
322
  return 'foo'
@@ -379,7 +379,7 @@ test('The request id log label can be changed', t => {
379
379
 
380
380
  const stream = split(JSON.parse)
381
381
  const fastify = Fastify({
382
- logger: { stream: stream, level: 'info' },
382
+ logger: { stream, level: 'info' },
383
383
  requestIdHeader: 'my-custom-request-id',
384
384
  requestIdLogLabel: 'traceId'
385
385
  })
@@ -422,7 +422,7 @@ test('The logger should accept custom serializer', t => {
422
422
  const stream = split(JSON.parse)
423
423
  const fastify = Fastify({
424
424
  logger: {
425
- stream: stream,
425
+ stream,
426
426
  level: 'info',
427
427
  serializers: {
428
428
  req: function (req) {
@@ -1151,7 +1151,7 @@ test('should serialize request and response', t => {
1151
1151
  const stream = split(JSON.parse)
1152
1152
  const fastify = Fastify({
1153
1153
  logger: {
1154
- stream: stream,
1154
+ stream,
1155
1155
  level: 'info'
1156
1156
  }
1157
1157
  })
@@ -1173,7 +1173,7 @@ test('Do not wrap IPv4 address', t => {
1173
1173
  const stream = split(JSON.parse)
1174
1174
  const fastify = Fastify({
1175
1175
  logger: {
1176
- stream: stream,
1176
+ stream,
1177
1177
  level: 'info'
1178
1178
  }
1179
1179
  })
@@ -1241,7 +1241,7 @@ test('should log the error if no error handler is defined', t => {
1241
1241
  const stream = split(JSON.parse)
1242
1242
  const fastify = Fastify({
1243
1243
  logger: {
1244
- stream: stream,
1244
+ stream,
1245
1245
  level: 'info'
1246
1246
  }
1247
1247
  })
@@ -1275,7 +1275,7 @@ test('should log as info if error status code >= 400 and < 500 if no error handl
1275
1275
  const stream = split(JSON.parse)
1276
1276
  const fastify = Fastify({
1277
1277
  logger: {
1278
- stream: stream,
1278
+ stream,
1279
1279
  level: 'info'
1280
1280
  }
1281
1281
  })
@@ -1313,7 +1313,7 @@ test('should log as error if error status code >= 500 if no error handler is def
1313
1313
  const stream = split(JSON.parse)
1314
1314
  const fastify = Fastify({
1315
1315
  logger: {
1316
- stream: stream,
1316
+ stream,
1317
1317
  level: 'info'
1318
1318
  }
1319
1319
  })
@@ -1347,7 +1347,7 @@ test('should not log the error if error handler is defined', t => {
1347
1347
  const stream = split(JSON.parse)
1348
1348
  const fastify = Fastify({
1349
1349
  logger: {
1350
- stream: stream,
1350
+ stream,
1351
1351
  level: 'info'
1352
1352
  }
1353
1353
  })
@@ -1381,7 +1381,7 @@ test('should not rely on raw request to log errors', t => {
1381
1381
  const stream = split(JSON.parse)
1382
1382
  const fastify = Fastify({
1383
1383
  logger: {
1384
- stream: stream,
1384
+ stream,
1385
1385
  level: 'info'
1386
1386
  }
1387
1387
  })
@@ -1412,7 +1412,7 @@ test('should redact the authorization header if so specified', t => {
1412
1412
  const stream = split(JSON.parse)
1413
1413
  const fastify = Fastify({
1414
1414
  logger: {
1415
- stream: stream,
1415
+ stream,
1416
1416
  redact: ['req.headers.authorization'],
1417
1417
  level: 'info',
1418
1418
  serializers: {
@@ -21,7 +21,7 @@ test('maxRequestsPerSocket on node version >= 16.10.0', { skip }, t => {
21
21
  t.error(err)
22
22
 
23
23
  const port = fastify.server.address().port
24
- const client = net.createConnection({ port: port }, () => {
24
+ const client = net.createConnection({ port }, () => {
25
25
  client.write('GET / HTTP/1.1\r\n\r\n')
26
26
 
27
27
  client.once('data', data => {
@@ -61,7 +61,7 @@ test('maxRequestsPerSocket zero should behave same as null', { skip }, t => {
61
61
  t.error(err)
62
62
 
63
63
  const port = fastify.server.address().port
64
- const client = net.createConnection({ port: port }, () => {
64
+ const client = net.createConnection({ port }, () => {
65
65
  client.write('GET / HTTP/1.1\r\n\r\n')
66
66
 
67
67
  client.once('data', data => {
@@ -0,0 +1,19 @@
1
+ 'use strict'
2
+
3
+ const tap = require('tap')
4
+ const noopSet = require('../lib/noop-set')
5
+
6
+ tap.test('does a lot of nothing', async t => {
7
+ const aSet = noopSet()
8
+ t.type(aSet, 'object')
9
+
10
+ const item = {}
11
+ aSet.add(item)
12
+ aSet.add({ another: 'item' })
13
+ aSet.delete(item)
14
+ t.equal(aSet.has(item), true)
15
+
16
+ for (const i of aSet) {
17
+ t.fail('should not have any items', i)
18
+ }
19
+ })
@@ -0,0 +1,10 @@
1
+ 'use strict'
2
+
3
+ const assert = require('assert')
4
+
5
+ module.exports = function (fastify, opts, done) {
6
+ assert.strictEqual(fastify.pluginName, 'test-plugin')
7
+ done()
8
+ }
9
+
10
+ module.exports[Symbol.for('fastify.display-name')] = 'test-plugin'
@@ -41,6 +41,24 @@ test('plugin metadata - ignore prefix', t => {
41
41
  }
42
42
  })
43
43
 
44
+ test('plugin metadata - naming plugins', async t => {
45
+ t.plan(2)
46
+ const fastify = Fastify()
47
+
48
+ fastify.register(require('./plugin.name.display'))
49
+ fastify.register(function (fastify, opts, done) {
50
+ // one line
51
+ t.equal(fastify.pluginName, 'function (fastify, opts, done) { -- // one line')
52
+ done()
53
+ })
54
+ fastify.register(function fooBar (fastify, opts, done) {
55
+ t.equal(fastify.pluginName, 'fooBar')
56
+ done()
57
+ })
58
+
59
+ await fastify.ready()
60
+ })
61
+
44
62
  test('fastify.register with fastify-plugin should not encapsulate his code', t => {
45
63
  t.plan(10)
46
64
  const fastify = Fastify()
@@ -8,6 +8,7 @@ const sget = require('simple-get').concat
8
8
  const joi = require('@hapi/joi')
9
9
  const Fastify = require('..')
10
10
  const proxyquire = require('proxyquire')
11
+ const { FST_ERR_INVALID_URL } = require('../lib/errors')
11
12
 
12
13
  test('route', t => {
13
14
  t.plan(9)
@@ -1268,3 +1269,14 @@ test('Correct error message is produced if "path" option is used', t => {
1268
1269
  })
1269
1270
  }, new Error('Error Handler for POST:/test route, if defined, must be a function'))
1270
1271
  })
1272
+
1273
+ test('invalid url attribute - non string URL', t => {
1274
+ t.plan(1)
1275
+ const fastify = Fastify()
1276
+
1277
+ try {
1278
+ fastify.get(/^\/(donations|skills|blogs)/, () => {})
1279
+ } catch (error) {
1280
+ t.equal(error.code, FST_ERR_INVALID_URL().code)
1281
+ }
1282
+ })
@@ -670,3 +670,44 @@ test('error in custom schema serialize compiler, throw FST_ERR_SCH_SERIALIZATION
670
670
  t.equal(err.code, 'FST_ERR_SCH_SERIALIZATION_BUILD')
671
671
  })
672
672
  })
673
+
674
+ test('Errors in searilizer sended to errorHandler', async t => {
675
+ let savedError
676
+
677
+ const fastify = Fastify()
678
+ fastify.get('/', {
679
+ schema: {
680
+ response: {
681
+ 200: {
682
+ type: 'object',
683
+ properties: {
684
+ name: { type: 'string' },
685
+ power: { type: 'string' }
686
+ },
687
+ required: ['name']
688
+ }
689
+ }
690
+ }
691
+
692
+ }, function (req, reply) {
693
+ reply.code(200).send({ no: 'thing' })
694
+ })
695
+ fastify.setErrorHandler((error, request, reply) => {
696
+ savedError = error
697
+ reply.code(500).send(error)
698
+ })
699
+
700
+ const res = await fastify.inject('/')
701
+
702
+ t.equal(res.statusCode, 500)
703
+
704
+ // t.same(savedError, new Error('"name" is required!'));
705
+ t.same(res.json(), {
706
+ statusCode: 500,
707
+ error: 'Internal Server Error',
708
+ message: '"name" is required!'
709
+ })
710
+ t.ok(savedError, 'error presents')
711
+ t.ok(savedError.serialization, 'Serialization sign presents')
712
+ t.end()
713
+ })
@@ -23,7 +23,7 @@ test('skip automatic reply.send() with reply.sent = true and a body', (t) => {
23
23
  const stream = split(JSON.parse)
24
24
  const app = Fastify({
25
25
  logger: {
26
- stream: stream
26
+ stream
27
27
  }
28
28
  })
29
29
 
@@ -52,7 +52,7 @@ test('skip automatic reply.send() with reply.sent = true and no body', (t) => {
52
52
  const stream = split(JSON.parse)
53
53
  const app = Fastify({
54
54
  logger: {
55
- stream: stream
55
+ stream
56
56
  }
57
57
  })
58
58
 
@@ -81,7 +81,7 @@ test('skip automatic reply.send() with reply.sent = true and an error', (t) => {
81
81
  const stream = split(JSON.parse)
82
82
  const app = Fastify({
83
83
  logger: {
84
- stream: stream
84
+ stream
85
85
  }
86
86
  })
87
87
 
@@ -125,7 +125,7 @@ function testHandlerOrBeforeHandlerHook (test, hookOrHandler) {
125
125
  const stream = split(JSON.parse)
126
126
  const app = Fastify({
127
127
  logger: {
128
- stream: stream
128
+ stream
129
129
  }
130
130
  })
131
131
 
@@ -170,7 +170,7 @@ function testHandlerOrBeforeHandlerHook (test, hookOrHandler) {
170
170
  const stream = split(JSON.parse)
171
171
  const app = Fastify({
172
172
  logger: {
173
- stream: stream
173
+ stream
174
174
  }
175
175
  })
176
176
  t.teardown(() => app.close())
@@ -224,7 +224,7 @@ function testHandlerOrBeforeHandlerHook (test, hookOrHandler) {
224
224
  const stream = split(JSON.parse)
225
225
  const app = Fastify({
226
226
  logger: {
227
- stream: stream
227
+ stream
228
228
  }
229
229
  })
230
230
  t.teardown(() => app.close())
@@ -274,7 +274,7 @@ function testHandlerOrBeforeHandlerHook (test, hookOrHandler) {
274
274
  const stream = split(JSON.parse)
275
275
  const app = Fastify({
276
276
  logger: {
277
- stream: stream
277
+ stream
278
278
  }
279
279
  })
280
280
 
@@ -16,7 +16,7 @@ const sgetForwardedRequest = (app, forHeader, path, protoHeader) => {
16
16
  }
17
17
  sget({
18
18
  method: 'GET',
19
- headers: headers,
19
+ headers,
20
20
  url: 'http://localhost:' + app.server.address().port + path
21
21
  }, () => {})
22
22
  }