@belmonddev/catch-request-express-middleware 2.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.
- package/index.js +3 -15
- 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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) => {
|