From 5dbf880ce3cdb227a85dbb0015609c210557c60b Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Tue, 8 Feb 2022 15:33:16 +0100 Subject: Fixed rendering of content --- src/components/Content/Content.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/components/Content') diff --git a/src/components/Content/Content.tsx b/src/components/Content/Content.tsx index 1341e4f..3d747b2 100644 --- a/src/components/Content/Content.tsx +++ b/src/components/Content/Content.tsx @@ -1,17 +1,15 @@ import * as React from "react"; import {Dispatch, SetStateAction, useContext, useMemo} from "react"; -import {RequestPayload, ResponsePayload} from "~hooks/useRequests"; +import {RequestPayload, ResponsePayload, Headers} from "~hooks/useRequests"; import ReactJson from 'react-json-view'; import styles from './Content.module.scss'; import {Button, Col, Container, Row} from "react-bootstrap"; import {DarkModeContext} from "../../contexts/DarkMode"; -function getHeader(headers: { [key: string]: string }, key: string, unit?: string): string | null { +function getHeader(headers: Headers, key: string, unit?: string): string | null { console.log(headers, key) try { - const [_, value] = Object - .entries(headers) - .find(([headerKey]) => headerKey.toLowerCase() === key.toLowerCase()) + const [_, value] = headers.find(([headerKey]) => headerKey.toLowerCase() === key.toLowerCase()) return unit !== undefined ? `${value}${unit}` : value -- cgit v1.2.3