Skip to content

Commit

Permalink
Hide empty Redirect URL and Comment properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobli committed Feb 8, 2017
1 parent 1a3c082 commit 7262da6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/ts/helpers/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ function identity<T>(source: T): T {
return source;
}

export function parseNonEmpty(input: string): string {
return input.trim().length > 0 ? input : undefined;
}

export function parseDate(input: string): Date {
const date = new Date(input);
if (isNaN(date.getTime())) {
Expand Down
8 changes: 4 additions & 4 deletions src/ts/waterfall/details-overlay/extract-details-keys.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {getHeader} from "../../helpers/har";
import {
formatBytes, formatDateLocalized, formatMilliseconds, parseAndFormat, parseDate,
formatBytes, formatDateLocalized, formatMilliseconds, parseAndFormat, parseDate, parseNonEmpty,
parseNonNegative, parsePositive,
} from "../../helpers/parse";
import {Entry, Header} from "../../typing/har";
Expand Down Expand Up @@ -57,7 +57,7 @@ function parseRequestDetails(harEntry: Entry): KvTuple[] {
byteSizeProperty("Bytes Out (uploaded)", harEntry._bytesOut),
byteSizeProperty("Headers Size", request.headersSize),
byteSizeProperty("Body Size", request.bodySize),
["Comment", request.comment],
["Comment", parseAndFormat(request.comment, parseNonEmpty)],
stringHeader("User-Agent"),
stringHeader("Host"),
stringHeader("Connection"),
Expand Down Expand Up @@ -119,8 +119,8 @@ function parseResponseDetails(harEntry: Entry): KvTuple[] {
stringHeader("Upgrade"),
stringHeader("Vary"),
stringHeader("Timing-Allow-Origin"),
["Redirect URL", response.redirectURL],
["Comment", response.comment],
["Redirect URL", parseAndFormat(response.redirectURL, parseNonEmpty)],
["Comment", parseAndFormat(response.comment, parseNonEmpty)],
];
}

Expand Down

0 comments on commit 7262da6

Please sign in to comment.