remove one listener

This commit is contained in:
Simon Knott 2024-09-14 12:13:46 +02:00
parent e21822891d
commit 513b1c2ab3
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -320,7 +320,6 @@ export abstract class APIRequestContext extends SdkObject {
const request = requestConstructor(url, requestOptions as any, async response => { const request = requestConstructor(url, requestOptions as any, async response => {
response.once('readable', () => { firstByteAt = monotonicTime(); }); response.once('readable', () => { firstByteAt = monotonicTime(); });
response.once('end', () => { endAt = monotonicTime(); });
const notifyRequestFinished = (body?: Buffer) => { const notifyRequestFinished = (body?: Buffer) => {
const timings: har.Timings = { const timings: har.Timings = {
@ -437,6 +436,7 @@ export abstract class APIRequestContext extends SdkObject {
const chunks: Buffer[] = []; const chunks: Buffer[] = [];
const notifyBodyFinished = () => { const notifyBodyFinished = () => {
endAt = monotonicTime();
const body = Buffer.concat(chunks); const body = Buffer.concat(chunks);
notifyRequestFinished(body); notifyRequestFinished(body);
fulfill({ fulfill({