Skip to content

Commit

Permalink
Show the HTTP version as a pill on request info
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Jan 3, 2024
1 parent be4c200 commit e067422
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/components/common/http-version-pill.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as React from 'react';

import { HtkRequest } from '../../types';
import { styled } from '../../styles';

import { Pill } from './pill';

export const HttpVersionPill = styled(({ request, className }: {
request: HtkRequest
className?: string
}) => request.httpVersion
? <Pill
title={`The client sent this request using HTTP ${request.httpVersion}`}
>HTTP/{
request.httpVersion === '2.0'
? '2'
: request.httpVersion
}</Pill>
: null
)``;
2 changes: 2 additions & 0 deletions src/components/view/http/http-request-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
} from '../../common/text-content';
import { DocsLink } from '../../common/docs-link';
import { SourceIcon } from '../../common/source-icon';
import { HttpVersionPill } from '../../common/http-version-pill';
import { HeaderDetails } from './header-details';
import { UrlBreakdown } from '../url-breakdown';

Expand Down Expand Up @@ -164,6 +165,7 @@ export const HttpRequestCard = observer((props: HttpRequestCardProps) => {
/>
}
<SourceIcon source={request.source} />
<HttpVersionPill request={request} />
<Pill color={getSummaryColour(exchange)}>
{ exchange.isWebSocket() ? 'WebSocket ' : '' }
{ request.method } {
Expand Down

0 comments on commit e067422

Please sign in to comment.