diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Details/Details.tsx | 8 | ||||
| -rw-r--r-- | src/hooks/useRequests.tsx | 10 |
2 files changed, 6 insertions, 12 deletions
diff --git a/src/components/Details/Details.tsx b/src/components/Details/Details.tsx index d4bb07a..96f0790 100644 --- a/src/components/Details/Details.tsx +++ b/src/components/Details/Details.tsx | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | import * as React from "react"; | 1 | import * as React from "react"; |
| 2 | import {useCallback, useMemo, useState} from "react"; | 2 | import {useCallback, useMemo, useState} from "react"; |
| 3 | import {RequestResponse} from "~hooks/useRequests"; | 3 | import {RequestResponse, Headers} from "~hooks/useRequests"; |
| 4 | import styles from "./Details.module.scss"; | 4 | import styles from "./Details.module.scss"; |
| 5 | import RequestSummary from "../RequestSummary/RequestSummary"; | 5 | import RequestSummary from "../RequestSummary/RequestSummary"; |
| 6 | import Content from "../Content/Content"; | 6 | import Content from "../Content/Content"; |
| @@ -28,9 +28,7 @@ function Timing({ timing }: TimingProps) { | |||
| 28 | 28 | ||
| 29 | interface HeadersProps { | 29 | interface HeadersProps { |
| 30 | title: string | 30 | title: string |
| 31 | headers: { | 31 | headers: Headers |
| 32 | [key: string]: string | ||
| 33 | } | ||
| 34 | } | 32 | } |
| 35 | 33 | ||
| 36 | function Headers({ title, headers }: HeadersProps) { | 34 | function Headers({ title, headers }: HeadersProps) { |
| @@ -50,7 +48,7 @@ function Headers({ title, headers }: HeadersProps) { | |||
| 50 | </thead> | 48 | </thead> |
| 51 | <tbody> | 49 | <tbody> |
| 52 | { | 50 | { |
| 53 | Object.entries(headers).map(([key, value]) => ( | 51 | headers.map(([key, value]) => ( |
| 54 | <tr> | 52 | <tr> |
| 55 | <td>{key}</td> | 53 | <td>{key}</td> |
| 56 | <td>{value}</td> | 54 | <td>{value}</td> |
diff --git a/src/hooks/useRequests.tsx b/src/hooks/useRequests.tsx index cb85162..204877a 100644 --- a/src/hooks/useRequests.tsx +++ b/src/hooks/useRequests.tsx | |||
| @@ -1,15 +1,12 @@ | |||
| 1 | import {useCallback, useEffect, useMemo, useState} from "react"; | 1 | import {useCallback, useEffect, useMemo, useState} from "react"; |
| 2 | import {getHost} from "../utils"; | 2 | import {getHost} from "../utils"; |
| 3 | 3 | ||
| 4 | type Dict = { | 4 | export type Headers = [string, string][] |
| 5 | [key: string]: string | ||
| 6 | } | ||
| 7 | 5 | ||
| 8 | export interface RequestPayload { | 6 | export interface RequestPayload { |
| 9 | id: string | 7 | id: string |
| 10 | body: string | 8 | body: string |
| 11 | cookies: Dict | 9 | headers: Headers |
| 12 | headers: Dict | ||
| 13 | method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 10 | method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' |
| 14 | path: string | 11 | path: string |
| 15 | } | 12 | } |
| @@ -23,8 +20,7 @@ export interface ResponsePayload { | |||
| 23 | id: string | 20 | id: string |
| 24 | timing: number | 21 | timing: number |
| 25 | body: string | 22 | body: string |
| 26 | cookies: Dict | 23 | headers: Headers |
| 27 | headers: Dict | ||
| 28 | status: number | 24 | status: number |
| 29 | } | 25 | } |
| 30 | 26 | ||
