add comment about connect

This commit is contained in:
Simon Knott 2024-09-16 09:57:25 +02:00
parent c0c036b480
commit 947942349a
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -320,12 +320,13 @@ export abstract class APIRequestContext extends SdkObject {
const request = requestConstructor(url, requestOptions as any, async response => { const request = requestConstructor(url, requestOptions as any, async response => {
const notifyRequestFinished = (body?: Buffer) => { const notifyRequestFinished = (body?: Buffer) => {
// spec: http://www.softwareishard.com/blog/har-12-spec/#timings
const timings: har.Timings = { const timings: har.Timings = {
send: requestFinishAt! - startAt, send: requestFinishAt! - startAt,
wait: firstByteAt! - requestFinishAt!, wait: firstByteAt! - requestFinishAt!,
receive: endAt! - firstByteAt!, receive: endAt! - firstByteAt!,
dns: dnsLookupAt ? dnsLookupAt - startAt : -1, dns: dnsLookupAt ? dnsLookupAt - startAt : -1,
connect: (tlsHandshakeAt ?? tcpConnectionAt!) - startAt, connect: (tlsHandshakeAt ?? tcpConnectionAt!) - startAt, // "If [ssl] is defined then the time is also included in the connect field "
ssl: tlsHandshakeAt ? tlsHandshakeAt - tcpConnectionAt! : -1, ssl: tlsHandshakeAt ? tlsHandshakeAt - tcpConnectionAt! : -1,
blocked: -1, blocked: -1,
}; };