fix(#1436): fixed inconsistent beheviour of res.getHeaders() api

This commit is contained in:
Anoop M D
2024-01-29 19:46:41 +05:30
parent 00e11e3177
commit 4917f24b7c
4 changed files with 8 additions and 6 deletions

View File

@@ -2,6 +2,8 @@ import React from 'react';
import StyledWrapper from './StyledWrapper';
const ResponseHeaders = ({ headers }) => {
const headersArray = typeof headers === 'object' ? Object.entries(headers) : [];
return (
<StyledWrapper className="pb-4 w-full">
<table>
@@ -12,8 +14,8 @@ const ResponseHeaders = ({ headers }) => {
</tr>
</thead>
<tbody>
{headers && headers.length
? headers.map((header, index) => {
{headersArray && headersArray.length
? headersArray.map((header, index) => {
return (
<tr key={index}>
<td className="key">{header[0]}</td>

View File

@@ -5,7 +5,7 @@ import StyledWrapper from './StyledWrapper';
const Timeline = ({ request, response }) => {
const requestHeaders = [];
const responseHeaders = response.headers || [];
const responseHeaders = typeof response.headers === 'object' ? Object.entries(response.headers) : [];
request = request || {};
response = response || {};