@webtypen/webframez-core 0.0.30 → 0.0.32

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.
@@ -2,6 +2,7 @@
2
2
  import { ServerResponse } from "http";
3
3
  export declare class Response {
4
4
  res?: ServerResponse;
5
+ statusCode: number;
5
6
  content?: any | null | undefined;
6
7
  /**
7
8
  * Mode
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Response = void 0;
4
4
  class Response {
5
5
  constructor(options) {
6
+ this.statusCode = 200;
6
7
  /**
7
8
  * Mode
8
9
  */
@@ -25,6 +26,7 @@ class Response {
25
26
  * @returns
26
27
  */
27
28
  status(status) {
29
+ this.statusCode = 200;
28
30
  if (!this.res) {
29
31
  return this;
30
32
  }
@@ -328,15 +328,14 @@ class RouterFacade {
328
328
  try {
329
329
  yield route.component(request, response);
330
330
  if (this.mode === "aws-lambda") {
331
- return { statusCode: 200, body: JSON.stringify(response.content) };
331
+ return { statusCode: response.statusCode, body: JSON.stringify(response.content) };
332
332
  }
333
333
  else if (res && req) {
334
334
  res.end();
335
- this.requestConsoleLog(req, 200);
335
+ this.requestConsoleLog(req, response.statusCode);
336
336
  }
337
337
  }
338
338
  catch (e) {
339
- console.error(e);
340
339
  if (this.mode === "aws-lambda") {
341
340
  return { statusCode: 500, body: JSON.stringify({ status: "error", message: "Error running the component ..." }) };
342
341
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",
@@ -2,6 +2,7 @@ import { ServerResponse } from "http";
2
2
 
3
3
  export class Response {
4
4
  res?: ServerResponse;
5
+ statusCode: number = 200;
5
6
  content?: any | null | undefined;
6
7
 
7
8
  /**
@@ -30,6 +31,8 @@ export class Response {
30
31
  * @returns
31
32
  */
32
33
  status(status: number): Response {
34
+ this.statusCode = 200;
35
+
33
36
  if (!this.res) {
34
37
  return this;
35
38
  }
@@ -373,14 +373,12 @@ class RouterFacade {
373
373
  await route.component(request, response);
374
374
 
375
375
  if (this.mode === "aws-lambda") {
376
- return { statusCode: 200, body: JSON.stringify(response.content) };
376
+ return { statusCode: response.statusCode, body: JSON.stringify(response.content) };
377
377
  } else if (res && req) {
378
378
  res.end();
379
- this.requestConsoleLog(req, 200);
379
+ this.requestConsoleLog(req, response.statusCode);
380
380
  }
381
381
  } catch (e) {
382
- console.error(e);
383
-
384
382
  if (this.mode === "aws-lambda") {
385
383
  return { statusCode: 500, body: JSON.stringify({ status: "error", message: "Error running the component ..." }) };
386
384
  } else if (res && req) {