From 9799b958f03f298c8a0dd3c487a0eab03ad6949e Mon Sep 17 00:00:00 2001 From: Eric Newport Date: Sat, 5 Sep 2026 09:03:08 -0400 Subject: [PATCH] 1.1.1 - Improved error handling. - Updated dependencies. --- CHANGELOG.md | 5 +++++ express-html-validator.js | 3 ++- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- test/test.js | 3 ++- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ab1d9..a88d568 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.1.1 + +- Improved error handling. +- Updated dependencies. + ## 1.1.0 - Breaking: Increased Node.js requirement to 22.5.0 or higher. diff --git a/express-html-validator.js b/express-html-validator.js index 664f828..409bac5 100644 --- a/express-html-validator.js +++ b/express-html-validator.js @@ -116,7 +116,8 @@ function captureResponseBody (accept) { this.writeHead(this.statusCode, statusMessage) this.end(finalBody, callback) } - Promise.resolve(rewrite(body)).then(send, error => { // send the body untouched rather than hanging the response if the rewrite fails + // the rewrite is called inside the chain rather than handed to Promise.resolve, so that a rewrite which throws outright is caught here alongside one that rejects; calling it first would let a throw escape res.end, taking the process down with the response never sent + Promise.resolve().then(() => rewrite(body)).then(send, error => { // send the body untouched rather than losing the response if the rewrite fails process.emitWarning(error) send(body) }) diff --git a/package-lock.json b/package-lock.json index 091525a..2d25082 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "express-html-validator", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "express-html-validator", - "version": "1.1.0", + "version": "1.1.1", "license": "CC-BY-4.0", "dependencies": { - "html-validate": "11.13.0", + "html-validate": "11.14.0", "prismjs": "1.30.0" }, "devDependencies": { @@ -2393,9 +2393,9 @@ } }, "node_modules/html-validate": { - "version": "11.13.0", - "resolved": "https://registry.npmjs.org/html-validate/-/html-validate-11.13.0.tgz", - "integrity": "sha512-+D/OzRlO1500q7N5Zq6TElX/HUmclqpKVh4B8z3ko1121I09i2fOrdiuYnufBOAFw85ex5cprn2fOZpzA41Utg==", + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/html-validate/-/html-validate-11.14.0.tgz", + "integrity": "sha512-QxZyjwlnrQYHhwtJUr79WIaJa7JWkjFXXu3yfzbdIsamdBK5X3TLYLkeqckW43Ws+4HuiH0fR5G9feIDL33FlA==", "funding": [ { "type": "github", @@ -2419,10 +2419,10 @@ }, "peerDependencies": { "@jest/globals": "^29.0.3 || ^30.0.0", - "@vitest/expect": "^3.2.0 || ^4.0.1", + "@vitest/expect": "^3.2.0 || ^4.0.1 || ^5.0.0", "jest": "^29.0.3 || ^30.0.0", "jest-snapshot": "^29.0.3 || ^30.0.0", - "vitest": "^3.2.0 || ^4.0.1" + "vitest": "^3.2.0 || ^4.0.1 || ^5.0.0" }, "peerDependenciesMeta": { "@jest/globals": { diff --git a/package.json b/package.json index ed461ea..00c36ec 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/rooseveltframework/express-html-validator/graphs/contributors" } ], - "version": "1.1.0", + "version": "1.1.1", "files": [ "templates", "express-html-validator.js", @@ -22,7 +22,7 @@ "node": ">=22.5.0" }, "dependencies": { - "html-validate": "11.13.0", + "html-validate": "11.14.0", "prismjs": "1.30.0" }, "devDependencies": { diff --git a/test/test.js b/test/test.js index c0c4be4..9130118 100644 --- a/test/test.js +++ b/test/test.js @@ -6,7 +6,8 @@ const expressValidator = require('..') const expressSetup = require('./lib/_expressSetup') const { brokenValidatorSetup, invalidHTML, validHTML } = expressSetup -const port = 43711 +// below 32768, which is where operating systems start handing out ports for outbound connections: linux uses 32768-60999 and macos and windows use 49152-65535, so a port inside those ranges can be taken by something else on the machine and leave the suite failing on a port nothing appears to be listening on +const port = 30711 const origin = `http://localhost:${port}` const fixtures = path.join(__dirname, 'fixtures') const validationFailed = 'HTML did not pass validator'