fastify 4.0.1 → 4.0.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.
- package/build/build-error-serializer.js +1 -0
- package/docs/Guides/Migration-Guide-V4.md +1 -1
- package/fastify.js +1 -1
- package/lib/reply.js +1 -1
- package/package.json +3 -3
- package/test/build/error-serializer.test.js +28 -0
- package/test/{internals → build}/version.test.js +1 -1
- package/test/reply-error.test.js +7 -1
|
@@ -14,7 +14,7 @@ Starting this version of Fastify, we have deprecated the use of `app.use()`. We
|
|
|
14
14
|
have decided not to support the use of middlewares. Both
|
|
15
15
|
[`@fastify/middie`](https://github.com/fastify/middie) and
|
|
16
16
|
[`@fastify/express`](https://github.com/fastify/fastify-express) will still be
|
|
17
|
-
there and maintained. Use Fastify's [hooks](
|
|
17
|
+
there and maintained. Use Fastify's [hooks](../Reference/Hooks.md) instead.
|
|
18
18
|
|
|
19
19
|
## Non Breaking Changes
|
|
20
20
|
|
package/fastify.js
CHANGED
package/lib/reply.js
CHANGED
|
@@ -291,7 +291,7 @@ Reply.prototype.removeTrailer = function (key) {
|
|
|
291
291
|
|
|
292
292
|
Reply.prototype.code = function (code) {
|
|
293
293
|
const intValue = parseInt(code)
|
|
294
|
-
if (isNaN(intValue) || intValue < 100 || intValue >
|
|
294
|
+
if (isNaN(intValue) || intValue < 100 || intValue > 599) {
|
|
295
295
|
throw new FST_ERR_BAD_STATUS_CODE(code || String(code))
|
|
296
296
|
}
|
|
297
297
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastify",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Fast and low overhead web framework, for Node.js",
|
|
5
5
|
"main": "fastify.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"lint:markdown": "markdownlint-cli2",
|
|
18
18
|
"lint:standard": "standard | snazzy",
|
|
19
19
|
"lint:typescript": "eslint -c types/.eslintrc.json types/**/*.d.ts test/types/**/*.test-d.ts",
|
|
20
|
-
"prepublishOnly": "tap --no-check-coverage test/
|
|
20
|
+
"prepublishOnly": "tap --no-check-coverage test/build/**.test.js",
|
|
21
21
|
"test": "npm run lint && npm run unit && npm run test:typescript",
|
|
22
22
|
"test:ci": "npm run unit -- -R terse --cov --coverage-report=lcovonly && npm run test:typescript",
|
|
23
23
|
"test:report": "npm run lint && npm run unit:report && npm run test:typescript",
|
|
@@ -146,7 +146,6 @@
|
|
|
146
146
|
"eslint-plugin-n": "^15.2.0",
|
|
147
147
|
"eslint-plugin-promise": "^6.0.0",
|
|
148
148
|
"fast-json-body": "^1.1.0",
|
|
149
|
-
"fast-json-stringify": "^4.1.0",
|
|
150
149
|
"fastify-plugin": "^3.0.1",
|
|
151
150
|
"fluent-json-schema": "^3.1.0",
|
|
152
151
|
"form-data": "^4.0.0",
|
|
@@ -182,6 +181,7 @@
|
|
|
182
181
|
"@fastify/fast-json-stringify-compiler": "^3.0.0",
|
|
183
182
|
"abstract-logging": "^2.0.1",
|
|
184
183
|
"avvio": "^8.1.3",
|
|
184
|
+
"fast-json-stringify": "^4.1.0",
|
|
185
185
|
"find-my-way": "^6.3.0",
|
|
186
186
|
"light-my-request": "^5.0.0",
|
|
187
187
|
"pino": "^8.0.0",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const t = require('tap')
|
|
4
|
+
const test = t.test
|
|
5
|
+
const fs = require('fs')
|
|
6
|
+
const path = require('path')
|
|
7
|
+
|
|
8
|
+
const { code } = require('../../build/build-error-serializer')
|
|
9
|
+
|
|
10
|
+
test('check generated code syntax', async (t) => {
|
|
11
|
+
t.plan(1)
|
|
12
|
+
|
|
13
|
+
// standard is a esm, we import it like this
|
|
14
|
+
const { default: standard } = await import('standard')
|
|
15
|
+
const result = await standard.lintText(code)
|
|
16
|
+
|
|
17
|
+
// if there are any invalid syntax
|
|
18
|
+
// fatal count will be greater than 0
|
|
19
|
+
t.equal(result[0].fatalErrorCount, 0)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('ensure the current error serializer is latest', async (t) => {
|
|
23
|
+
t.plan(1)
|
|
24
|
+
|
|
25
|
+
const current = await fs.promises.readFile(path.resolve('lib/error-serializer.js'))
|
|
26
|
+
|
|
27
|
+
t.equal(current.toString(), code)
|
|
28
|
+
})
|
package/test/reply-error.test.js
CHANGED
|
@@ -520,7 +520,13 @@ const invalidErrorCodes = [
|
|
|
520
520
|
undefined,
|
|
521
521
|
null,
|
|
522
522
|
'error_code',
|
|
523
|
-
|
|
523
|
+
|
|
524
|
+
// out of the 100-599 range:
|
|
525
|
+
0,
|
|
526
|
+
1,
|
|
527
|
+
99,
|
|
528
|
+
600,
|
|
529
|
+
700
|
|
524
530
|
]
|
|
525
531
|
invalidErrorCodes.forEach((invalidCode) => {
|
|
526
532
|
test(`should throw error if error code is ${invalidCode}`, t => {
|