Skip to content

Commit 7262da6

Browse files
committed
Hide empty Redirect URL and Comment properties.
1 parent 1a3c082 commit 7262da6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Diff for: src/ts/helpers/parse.ts

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ function identity<T>(source: T): T {
2626
return source;
2727
}
2828

29+
export function parseNonEmpty(input: string): string {
30+
return input.trim().length > 0 ? input : undefined;
31+
}
32+
2933
export function parseDate(input: string): Date {
3034
const date = new Date(input);
3135
if (isNaN(date.getTime())) {

Diff for: src/ts/waterfall/details-overlay/extract-details-keys.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {getHeader} from "../../helpers/har";
22
import {
3-
formatBytes, formatDateLocalized, formatMilliseconds, parseAndFormat, parseDate,
3+
formatBytes, formatDateLocalized, formatMilliseconds, parseAndFormat, parseDate, parseNonEmpty,
44
parseNonNegative, parsePositive,
55
} from "../../helpers/parse";
66
import {Entry, Header} from "../../typing/har";
@@ -57,7 +57,7 @@ function parseRequestDetails(harEntry: Entry): KvTuple[] {
5757
byteSizeProperty("Bytes Out (uploaded)", harEntry._bytesOut),
5858
byteSizeProperty("Headers Size", request.headersSize),
5959
byteSizeProperty("Body Size", request.bodySize),
60-
["Comment", request.comment],
60+
["Comment", parseAndFormat(request.comment, parseNonEmpty)],
6161
stringHeader("User-Agent"),
6262
stringHeader("Host"),
6363
stringHeader("Connection"),
@@ -119,8 +119,8 @@ function parseResponseDetails(harEntry: Entry): KvTuple[] {
119119
stringHeader("Upgrade"),
120120
stringHeader("Vary"),
121121
stringHeader("Timing-Allow-Origin"),
122-
["Redirect URL", response.redirectURL],
123-
["Comment", response.comment],
122+
["Redirect URL", parseAndFormat(response.redirectURL, parseNonEmpty)],
123+
["Comment", parseAndFormat(response.comment, parseNonEmpty)],
124124
];
125125
}
126126

0 commit comments

Comments
 (0)