fix: Prevent HttpRequest from being closed

In case a stream the request is being piped into closes,
we don't want to close the request since it shares a socket
with the response.
This commit is contained in:
Joachim Van Herwegen
2021-04-08 13:21:03 +02:00
parent 218c8f4662
commit 953458231b
5 changed files with 106 additions and 10 deletions

View File

@@ -0,0 +1,10 @@
import { isHttpRequest } from '../../../src/server/HttpRequest';
describe('HttpRequest', (): void => {
describe('#isHttpRequest', (): void => {
it('can identify HttpRequests.', async(): Promise<void> => {
expect(isHttpRequest({})).toBe(false);
expect(isHttpRequest({ socket: {}, method: 'GET', url: '/url' })).toBe(true);
});
});
});