refactor endAt
This commit is contained in:
parent
5d8ab8a33c
commit
dde4488ebb
|
|
@ -315,11 +315,11 @@ export abstract class APIRequestContext extends SdkObject {
|
||||||
let tcpConnectionAt: number | undefined;
|
let tcpConnectionAt: number | undefined;
|
||||||
let tlsHandshakeAt: number | undefined;
|
let tlsHandshakeAt: number | undefined;
|
||||||
let requestFinishAt: number | undefined;
|
let requestFinishAt: number | undefined;
|
||||||
let endAt: number | undefined;
|
|
||||||
|
|
||||||
const request = requestConstructor(url, requestOptions as any, async response => {
|
const request = requestConstructor(url, requestOptions as any, async response => {
|
||||||
const responseAt = monotonicTime();
|
const responseAt = monotonicTime();
|
||||||
const notifyRequestFinished = (body?: Buffer) => {
|
const notifyRequestFinished = (body?: Buffer) => {
|
||||||
|
const endAt = monotonicTime();
|
||||||
// spec: http://www.softwareishard.com/blog/har-12-spec/#timings
|
// spec: http://www.softwareishard.com/blog/har-12-spec/#timings
|
||||||
const timings: har.Timings = {
|
const timings: har.Timings = {
|
||||||
send: requestFinishAt! - startAt,
|
send: requestFinishAt! - startAt,
|
||||||
|
|
@ -435,7 +435,6 @@ 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({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue