@webdecoy/express 0.8.0 → 0.8.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.
package/dist/index.js CHANGED
@@ -103,7 +103,9 @@ function webdecoy(config) {
103
103
  let intercepting = null;
104
104
  const shouldIntercept = () => {
105
105
  if (intercepting === null) {
106
- intercepting = !res.headersSent && (0, import_node2.isInjectableHtml)(res.getHeader("content-type"));
106
+ const isHtml = (0, import_node2.isInjectableHtml)(res.getHeader("content-type"));
107
+ const lengthCommitted = res.headersSent && res.getHeader("content-length") !== void 0;
108
+ intercepting = isHtml && !lengthCommitted;
107
109
  }
108
110
  return intercepting;
109
111
  };
package/dist/index.mjs CHANGED
@@ -81,7 +81,9 @@ function webdecoy(config) {
81
81
  let intercepting = null;
82
82
  const shouldIntercept = () => {
83
83
  if (intercepting === null) {
84
- intercepting = !res.headersSent && isInjectableHtml(res.getHeader("content-type"));
84
+ const isHtml = isInjectableHtml(res.getHeader("content-type"));
85
+ const lengthCommitted = res.headersSent && res.getHeader("content-length") !== void 0;
86
+ intercepting = isHtml && !lengthCommitted;
85
87
  }
86
88
  return intercepting;
87
89
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webdecoy/express",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Web Decoy middleware for Express.js",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "url": "https://github.com/WebDecoy/node/issues"
41
41
  },
42
42
  "dependencies": {
43
- "@webdecoy/node": "^0.8.0"
43
+ "@webdecoy/node": "^0.8.1"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "express": "^4.18.0 || ^5.0.0"