badmfck-api-server 4.1.12 → 4.1.13

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.
@@ -98,7 +98,7 @@ async function Initializer(services) {
98
98
  }
99
99
  exports.Initializer = Initializer;
100
100
  class APIService extends BaseService_1.BaseService {
101
- version = "4.1.12";
101
+ version = "4.1.13";
102
102
  options;
103
103
  monitor = null;
104
104
  started = new Date();
@@ -456,14 +456,16 @@ class APIService extends BaseService_1.BaseService {
456
456
  nextLogID = 0;
457
457
  }
458
458
  async sendResponse(ref, res, data, requestTime, endpoint, req) {
459
+ const ignoreHttpLogging = data.ignoreHttpLogging ?? false;
460
+ delete data.ignoreHttpLogging;
459
461
  if (data.blockResponse) {
460
- if (!data.ignoreHttpLogging)
462
+ if (!ignoreHttpLogging)
461
463
  (0, LogService_1.logAPI)("Response blocked");
462
- if (req && !data.ignoreHttpLogging)
464
+ if (req && !ignoreHttpLogging)
463
465
  this.addNetlog(data, req, requestTime, 0);
464
466
  return;
465
467
  }
466
- if (!data.ignoreHttpLogging)
468
+ if (!ignoreHttpLogging)
467
469
  MonitorService_1.S_STAT_REGISTRATE_REQUEST.invoke({ ...data, endpoint: data.endpoint ?? endpoint });
468
470
  if (this.options.postproducer) {
469
471
  try {
@@ -481,7 +483,7 @@ class APIService extends BaseService_1.BaseService {
481
483
  if (this.options.appVersion)
482
484
  data.version = this.options.appVersion;
483
485
  if (res.socket?.destroyed || res.writableEnded || res.headersSent || (res.destroyed !== undefined && res.destroyed)) {
484
- if (!data.ignoreHttpLogging)
486
+ if (!ignoreHttpLogging)
485
487
  (0, LogService_1.logAPI)("Connection already closed, can't send response for: " + data.endpoint);
486
488
  }
487
489
  else {
@@ -490,7 +492,7 @@ class APIService extends BaseService_1.BaseService {
490
492
  const normalizedFile = process.platform === "win32" ? data.file : data.file.replaceAll("\\", "/");
491
493
  const filePath = path_1.default.isAbsolute(normalizedFile) ? normalizedFile : path_1.default.resolve(normalizedFile);
492
494
  const onSendFileError = (err) => {
493
- if (!data.ignoreHttpLogging)
495
+ if (!ignoreHttpLogging)
494
496
  (0, LogService_1.logError)("Can't send file: " + filePath);
495
497
  if (!res.headersSent && !res.writableEnded) {
496
498
  res.status(500).send({ error: DefaultErrors_1.default.CANT_SEND_FILE, data: null });
@@ -536,12 +538,12 @@ class APIService extends BaseService_1.BaseService {
536
538
  res.statusCode = data.httpStatus ?? 200;
537
539
  if (data.rawResponse) {
538
540
  res.send(data.data);
539
- if (!data.ignoreHttpLogging)
541
+ if (!ignoreHttpLogging)
540
542
  (0, LogService_1.logAPI)(this.checkDataLength(data));
541
543
  }
542
544
  else {
543
545
  res.send(data);
544
- if (!data.ignoreHttpLogging)
546
+ if (!ignoreHttpLogging)
545
547
  (0, LogService_1.logAPI)(this.checkDataLength(data));
546
548
  }
547
549
  }
@@ -550,7 +552,7 @@ class APIService extends BaseService_1.BaseService {
550
552
  console.error(e);
551
553
  }
552
554
  }
553
- if (req && !data.ignoreHttpLogging)
555
+ if (req && !ignoreHttpLogging)
554
556
  this.addNetlog(data, req, requestTime, 0);
555
557
  }
556
558
  checkDataLength(data, result, lvl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "4.1.12",
3
+ "version": "4.1.13",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",