Sort headers when displaying them

Summary: It's easier to scan the same header value of multiple requests when it's in roughly the same place for each one.

Reviewed By: mweststrate

Differential Revision: D24885172

fbshipit-source-id: 7be02903d2f9f79c8ba618e57c74169392f6244b
This commit is contained in:
John Knox
2020-11-11 03:47:18 -08:00
committed by Facebook GitHub Bot
parent a9ac4da146
commit fd8065eb7a

View File

@@ -271,20 +271,22 @@ class HeaderInspector extends Component<
); );
const rows: any = []; const rows: any = [];
computedHeaders.forEach((value: string, key: string) => { Array.from(computedHeaders.entries())
rows.push({ .sort((a, b) => (a[0] < b[0] ? -1 : a[0] == b[0] ? 0 : 1))
columns: { .forEach(([key, value]) => {
key: { rows.push({
value: <WrappingText>{key}</WrappingText>, columns: {
key: {
value: <WrappingText>{key}</WrappingText>,
},
value: {
value: <WrappingText>{value}</WrappingText>,
},
}, },
value: { copyText: value,
value: <WrappingText>{value}</WrappingText>, key,
}, });
},
copyText: value,
key,
}); });
});
return rows.length > 0 ? ( return rows.length > 0 ? (
<ManagedTable <ManagedTable