respect omitServerIP

This commit is contained in:
Simon Knott 2024-09-17 19:43:29 +02:00
parent fa2fff4bac
commit 72da91a9b4
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
2 changed files with 7 additions and 2 deletions

View file

@ -208,13 +208,16 @@ export class HarTracer {
if (!harEntry)
return;
harEntry.serverIPAddress = event.serverIPAddress;
harEntry._serverPort = event.serverPort;
harEntry.response.status = event.statusCode;
harEntry.response.statusText = event.statusMessage;
harEntry.response.httpVersion = event.httpVersion;
harEntry.response.redirectURL = event.headers.location || '';
if (!this._options.omitServerIP) {
harEntry.serverIPAddress = event.serverIPAddress;
harEntry._serverPort = event.serverPort;
}
if (!this._options.omitTiming) {
harEntry.timings = event.timings;
this._computeHarEntryTotalTime(harEntry);

View file

@ -847,6 +847,8 @@ it('should respect minimal mode for API Requests', async ({ contextFactory, serv
expect(entries).toHaveLength(1);
const [entry] = entries;
expect(entry.timings).toEqual({ receive: -1, send: -1, wait: -1 });
expect(entry.serverIPAddress).toBeUndefined();
expect(entry._serverPort).toBeUndefined();
});
it('should include redirects from API request', async ({ contextFactory, server }, testInfo) => {