@anhocva214/logzen 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -55,8 +55,7 @@ function logzen(options = {}) {
55
55
  chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
56
56
  }
57
57
  let responseBody = Buffer.concat(chunks).toString("utf8");
58
- // If the response body appears to be HTML, set it to "<HTML>"
59
- if (/^\s*<\s*html/i.test(responseBody)) {
58
+ if (/^\s*(<!doctype\s+html|<html)/i.test(responseBody)) {
60
59
  responseBody = "<HTML>";
61
60
  }
62
61
  const duration = Date.now() - startTime;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anhocva214/logzen",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A lightweight logging middleware for Node.js/Express written in TypeScript that logs request and response details in JSON format.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -46,8 +46,7 @@ export function logzen(options: LogZenOptions = {}) {
46
46
  }
47
47
  let responseBody = Buffer.concat(chunks).toString("utf8");
48
48
 
49
- // If the response body appears to be HTML, set it to "<HTML>"
50
- if (/^\s*<\s*html/i.test(responseBody)) {
49
+ if (/^\s*(<!doctype\s+html|<html)/i.test(responseBody)) {
51
50
  responseBody = "<HTML>";
52
51
  }
53
52