Skip to content

Commit 420e9a6

Browse files
authored
fix: use pipeline in place of pipe to better handle cleanup / errors (#299)
1 parent 3b911bd commit 420e9a6

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

core/packages/teeny-request/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import {Agent, AgentOptions as HttpsAgentOptions} from 'https';
1919
import {AgentOptions as HttpAgentOptions} from 'http';
2020
import fetch, * as f from 'node-fetch';
21-
import {PassThrough, Readable} from 'stream';
21+
import {PassThrough, Readable, pipeline} from 'stream';
2222
import * as uuid from 'uuid';
2323
import {getAgent} from './agents';
2424
import {TeenyStatistics} from './TeenyStatistics';
@@ -263,10 +263,10 @@ function teenyRequest(
263263
let responseStream: any;
264264
requestStream.once('reading', () => {
265265
if (responseStream) {
266-
responseStream.pipe(requestStream);
266+
pipeline(responseStream, requestStream, () => {});
267267
} else {
268268
requestStream.once('response', () => {
269-
responseStream.pipe(requestStream);
269+
pipeline(responseStream, requestStream, () => {});
270270
});
271271
}
272272
});

0 commit comments

Comments
 (0)