From f3283a4c901a7497d16a4f0320cb8a7d096a826d Mon Sep 17 00:00:00 2001 From: Thibaut Rousseau Date: Sat, 6 Nov 2021 23:49:21 +0100 Subject: [PATCH] add text http status code as tooltip in response --- client/components/History.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client/components/History.tsx b/client/components/History.tsx index 5ef3254..395a5f6 100644 --- a/client/components/History.tsx +++ b/client/components/History.tsx @@ -17,6 +17,7 @@ import { Typography, } from "antd"; import dayjs from "dayjs"; +import { getReasonPhrase } from "http-status-codes"; import yaml from "js-yaml"; import orderBy from "lodash/orderBy"; import * as React from "react"; @@ -65,6 +66,16 @@ const EntryComponent = React.memo( responseStatusColor = "orange"; } } + + let responseStatusTitle = "Unknown HTTP status code"; + try { + responseStatusTitle = getReasonPhrase(value.response.status); + } catch { + if (value.response.status >= 600) { + responseStatusTitle = "Smocker error"; + } + } + return (
@@ -104,7 +115,9 @@ const EntryComponent = React.memo(
{value.context.mock_type === "proxy" && Proxified} - {value.response.status} + + {value.response.status} + {value.response.status > 600 && (