fix(VirtualStream): Fix keepAlive flag handling in VirtualStream and added stream closure in tests

This commit is contained in:
Philipp Kunz 2024-10-14 01:42:44 +02:00
parent f9b5c897cf
commit d38a225c78
4 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 2024-10-14 - 3.1.3 - fix(VirtualStream)
Fix keepAlive flag handling in VirtualStream and added stream closure in tests
- Ensure that the keepAlive status is correctly maintained in the keepAlive trigger method.
- Added closure of VirtualStreams in the test suite for proper resource cleanup.
## 2024-10-14 - 3.1.2 - fix(core)
Fix incorrect backpressure logic in VirtualStream class

View File

@ -98,6 +98,8 @@ tap.test('should allow VirtualStreams', async () => {
const data = await generatedRequestingVS.fetchData();
const decodedData = new TextDecoder().decode(data);
expect(decodedData).toEqual('hello');
await newRequestingVS.close();
await newRespondingVS.close();
});
tap.test('should end the server', async (toolsArg) => {

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@api.global/typedrequest',
version: '3.1.2',
version: '3.1.3',
description: 'A TypeScript library for making typed requests towards APIs, including facilities for handling requests, routing, and virtual stream handling.'
}

View File

@ -327,7 +327,7 @@ export class VirtualStream<T = Uint8Array> implements plugins.typedRequestInterf
cycleId: plugins.isounique.uni(),
cycle: 'request',
mainPurpose: 'keepAlive',
keepAlive: true,
keepAlive: this.keepAlive,
},
response: null,
}).catch(() => {