fix(tracing): record available response headers without waiting for extra info (#23483)
Fixes #23115
This commit is contained in:
parent
dd3ca6907a
commit
401fc4cb9e
|
|
@ -478,18 +478,26 @@ export class HarTracer {
|
||||||
this._addBarrier(page || request.serviceWorker(), request.rawRequestHeaders().then(headers => {
|
this._addBarrier(page || request.serviceWorker(), request.rawRequestHeaders().then(headers => {
|
||||||
this._recordRequestHeadersAndCookies(harEntry, headers);
|
this._recordRequestHeadersAndCookies(harEntry, headers);
|
||||||
}));
|
}));
|
||||||
|
// Record available headers including redirect location in case the tracing is stopped before
|
||||||
|
// reponse extra info is received (in Chromium).
|
||||||
|
this._recordResponseHeaders(harEntry, response.headers());
|
||||||
this._addBarrier(page || request.serviceWorker(), response.rawResponseHeaders().then(headers => {
|
this._addBarrier(page || request.serviceWorker(), response.rawResponseHeaders().then(headers => {
|
||||||
if (!this._options.omitCookies) {
|
this._recordResponseHeaders(harEntry, headers);
|
||||||
for (const header of headers.filter(header => header.name.toLowerCase() === 'set-cookie'))
|
|
||||||
harEntry.response.cookies.push(parseCookie(header.value));
|
|
||||||
}
|
|
||||||
harEntry.response.headers = headers;
|
|
||||||
const contentType = headers.find(header => header.name.toLowerCase() === 'content-type');
|
|
||||||
if (contentType)
|
|
||||||
harEntry.response.content.mimeType = contentType.value;
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _recordResponseHeaders(harEntry: har.Entry, headers: HeadersArray) {
|
||||||
|
if (!this._options.omitCookies) {
|
||||||
|
harEntry.response.cookies = headers
|
||||||
|
.filter(header => header.name.toLowerCase() === 'set-cookie')
|
||||||
|
.map(header => parseCookie(header.value));
|
||||||
|
}
|
||||||
|
harEntry.response.headers = headers;
|
||||||
|
const contentType = headers.find(header => header.name.toLowerCase() === 'content-type');
|
||||||
|
if (contentType)
|
||||||
|
harEntry.response.content.mimeType = contentType.value;
|
||||||
|
}
|
||||||
|
|
||||||
private _computeHarEntryTotalTime(harEntry: har.Entry) {
|
private _computeHarEntryTotalTime(harEntry: har.Entry) {
|
||||||
harEntry.time = [
|
harEntry.time = [
|
||||||
harEntry.timings.dns,
|
harEntry.timings.dns,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue