@belmonddev/catch-request-express-middleware 3.0.0 → 3.0.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.
Files changed (2) hide show
  1. package/index.js +3 -15
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -43,20 +43,12 @@ const catchHttpResponse = (reqObject, responseCb) => {
43
43
  zlibFunc(buffer, (_, decoded) => {
44
44
  const stringBody = decoded.toString('utf8');
45
45
  const request = { ...responseObj, body: stringBody };
46
- if (responseCb?.then) {
47
- responseCb.then(() => request);
48
- } else {
49
- responseCb(request);
50
- }
46
+ responseCb(request);
51
47
  });
52
48
  } else {
53
49
  const stringBody = chunks.map((c) => c.toString('utf8')).join('');
54
50
  const request = { ...responseObj, body: stringBody };
55
- if (responseCb?.then) {
56
- responseCb.then(() => request);
57
- } else {
58
- responseCb(request);
59
- }
51
+ responseCb(request);
60
52
  }
61
53
  });
62
54
  }
@@ -100,11 +92,7 @@ const callResponseCb = (responseCb, res) => {
100
92
  statusMessage: res.statusMessage,
101
93
  body: res.bodyWritten,
102
94
  };
103
- if (responseCb?.then) {
104
- responseCb.then(() => response);
105
- } else {
106
- responseCb(response);
107
- }
95
+ responseCb(response);
108
96
  };
109
97
 
110
98
  const callReceivedCbs = (req, res, requestReceivedCb, body) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belmonddev/catch-request-express-middleware",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "start": "nodemon -L --experimental-specifier-resolution=node ./src/index.js"