mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-01 08:50:27 +00:00
Handle nullable vars (#47)
This commit is contained in:
parent
132b158dbb
commit
d975e76555
@ -10,6 +10,6 @@ interface EndpointPathProps {
|
||||
export const EndpointPath: React.FC<EndpointPathProps> = ({method, path}) => {
|
||||
return <div className={styles.container}>
|
||||
{method && <span className={`${miscStyles.protocol} ${miscStyles.method}`}>{method}</span>}
|
||||
<div title={path} className={styles.path}>{path}</div>
|
||||
{path && <div title={path} className={styles.path}>{path}</div>}
|
||||
</div>
|
||||
};
|
@ -30,7 +30,6 @@ const HarEntryTitle: React.FC<any> = ({har}) => {
|
||||
|
||||
const {log: {entries}} = har;
|
||||
const {response, request, timings: {receive}} = entries[0];
|
||||
const {method, url} = request;
|
||||
const {status, statusText, bodySize} = response;
|
||||
|
||||
|
||||
@ -39,7 +38,7 @@ const HarEntryTitle: React.FC<any> = ({har}) => {
|
||||
<StatusCode statusCode={status}/>
|
||||
</div>}
|
||||
<div style={{flexGrow: 1, overflow: 'hidden'}}>
|
||||
<EndpointPath method={method} path={url}/>
|
||||
<EndpointPath method={request?.method} path={request?.url}/>
|
||||
</div>
|
||||
<div style={{margin: "0 24px", opacity: 0.5}}>{formatSize(bodySize)}</div>
|
||||
<div style={{marginRight: 24, opacity: 0.5}}>{status} {statusText}</div>
|
||||
|
@ -7,7 +7,6 @@ const MIME_TYPE_KEY = 'mimeType';
|
||||
|
||||
const HAREntryDisplay: React.FC<any> = ({entry, isCollapsed: initialIsCollapsed, isResponseMocked}) => {
|
||||
const {request, response} = entry;
|
||||
const { url, postData} = request;
|
||||
|
||||
const TABS = [
|
||||
{tab: 'request'},
|
||||
@ -24,7 +23,7 @@ const HAREntryDisplay: React.FC<any> = ({entry, isCollapsed: initialIsCollapsed,
|
||||
{!initialIsCollapsed && <div className={styles.body}>
|
||||
<div className={styles.bodyHeader}>
|
||||
<Tabs tabs={TABS} currentTab={currentTab} onChange={setCurrentTab} leftAligned/>
|
||||
<a className={styles.endpointURL} href={url} target='_blank' rel="noreferrer">{url}</a>
|
||||
{request?.url && <a className={styles.endpointURL} href={request.url} target='_blank' rel="noreferrer">{request.url}</a>}
|
||||
</div>
|
||||
{
|
||||
currentTab === TABS[0].tab && <React.Fragment>
|
||||
@ -32,7 +31,7 @@ const HAREntryDisplay: React.FC<any> = ({entry, isCollapsed: initialIsCollapsed,
|
||||
|
||||
<HAREntryTableSection title={'Cookies'} arrayToIterate={request.cookies}/>
|
||||
|
||||
{postData && <HAREntryBodySection content={postData} encoding={postData.comment} contentType={postData[MIME_TYPE_KEY]}/>}
|
||||
{request?.postData && <HAREntryBodySection content={request.postData} encoding={request.postData.comment} contentType={request.postData[MIME_TYPE_KEY]}/>}
|
||||
|
||||
<HAREntryTableSection title={'Query'} arrayToIterate={request.queryString}/>
|
||||
</React.Fragment>
|
||||
|
Loading…
Reference in New Issue
Block a user