@belmonddev/catch-request-express-middleware 3.3.2 → 3.3.4
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 +4 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -150,8 +150,9 @@ const callIncomingRequestsCbs = (req, res, incomingRequestsCb, body) => {
|
|
|
150
150
|
if (req.socketClosed) {
|
|
151
151
|
callResponseCb(responseCb, res);
|
|
152
152
|
} else {
|
|
153
|
-
|
|
154
|
-
res.statusCode =
|
|
153
|
+
res.on('timeout', () => {
|
|
154
|
+
res.statusCode = 408;
|
|
155
|
+
res.end();
|
|
155
156
|
});
|
|
156
157
|
req.socket.on('close', () => {
|
|
157
158
|
callResponseCb(responseCb, res);
|
|
@@ -164,6 +165,7 @@ const catchExpressIncomingRequest = (req, res, incomingRequestCb) => {
|
|
|
164
165
|
// we override write method ASAP cause otherwise if the request finishes too fast the response callback is not called
|
|
165
166
|
let writeCount = 0;
|
|
166
167
|
let firstData = '';
|
|
168
|
+
res.bodyWritten = '';
|
|
167
169
|
override(req.socket, 'write', (result, data) => {
|
|
168
170
|
writeCount++;
|
|
169
171
|
if (writeCount === 1) {
|