express-zod-api
Advanced tools
Comparing version 2.5.0 to 2.5.1
@@ -5,2 +5,8 @@ # Changelog | ||
### v2.5.1 | ||
- Fixed a bug due to which the execution of the code could continue despite the possible closing of the response | ||
stream by one of the middlewares. | ||
- Affected Node versions: below 12.9.0. | ||
### v2.5.0 | ||
@@ -7,0 +13,0 @@ |
@@ -125,2 +125,3 @@ "use strict"; | ||
const options = {}; | ||
let isStreamClosed = false; | ||
for (const def of this.middlewares) { | ||
@@ -132,7 +133,10 @@ input = { ...input, ...def.input.parse(input) }; // middleware can transform the input types | ||
})); | ||
if (response.writableEnded) { | ||
isStreamClosed = ('writableEnded' in response && response.writableEnded) || | ||
('finished' in response && response.finished); // Node v10 and below | ||
if (isStreamClosed) { | ||
logger.warn(`The middleware ${def.middleware.name} has closed the stream. Accumulated options:`, options); | ||
break; | ||
} | ||
} | ||
return { input, options, isStreamClosed: response.writableEnded }; | ||
return { input, options, isStreamClosed }; | ||
}, _Endpoint_parseAndRunHandler = async function _Endpoint_parseAndRunHandler({ input, options, logger }) { | ||
@@ -139,0 +143,0 @@ return await this.handler({ |
{ | ||
"name": "express-zod-api", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "A Typescript library to help you get an API server up and running with I/O schema validation and custom middlewares in minutes.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
142618
1427