mirror of
https://github.com/microsoft/playwright.git
synced 2024-11-28 09:23:42 +03:00
<img width="182" alt="image" src="https://github.com/user-attachments/assets/8b381bcc-46e3-45c7-8fd2-e020436d1bff"> <img width="206" alt="image" src="https://github.com/user-attachments/assets/4ea02b47-a4da-44f7-9c26-13b05374e89d"> <img width="213" alt="image" src="https://github.com/user-attachments/assets/38b50e2a-f69c-4a78-abb2-2680453fc5fd">
This commit is contained in:
parent
7ff46d4596
commit
71e5eade8c
@ -61,3 +61,27 @@
|
||||
.tab-network .tabbed-pane-tab.selected {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.green-circle::before,
|
||||
.red-circle::before,
|
||||
.yellow-circle::before {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 6px;
|
||||
margin-right: 2px;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.green-circle::before {
|
||||
background-color: var(--vscode-charts-green);
|
||||
}
|
||||
|
||||
.red-circle::before {
|
||||
background-color: var(--vscode-charts-red);
|
||||
}
|
||||
|
||||
.yellow-circle::before {
|
||||
background-color: var(--vscode-charts-yellow);
|
||||
}
|
||||
|
@ -80,11 +80,10 @@ const RequestTab: React.FunctionComponent<{
|
||||
<div className='network-request-details-header'>General</div>
|
||||
<div className='network-request-details-url'>{`URL: ${resource.request.url}`}</div>
|
||||
<div className='network-request-details-general'>{`Method: ${resource.request.method}`}</div>
|
||||
<div className='network-request-details-general'>{`Status Code: ${
|
||||
resource.response.status >= 200 && resource.response.status < 400
|
||||
? `🟢 ${resource.response.status} ${resource.response.statusText}`
|
||||
: `🔴 ${resource.response.status} ${resource.response.statusText}`
|
||||
}`}</div>
|
||||
<div className='network-request-details-general' style={{ display: 'flex' }}>
|
||||
Status Code: <span className={statusClass(resource.response.status)} style={{ display: 'inline-flex' }}>
|
||||
{`${resource.response.status} ${resource.response.statusText}`}
|
||||
</span></div>
|
||||
<div className='network-request-details-header'>Request Headers</div>
|
||||
<div className='network-request-details-headers'>{resource.request.headers.map(pair => `${pair.name}: ${pair.value}`).join('\n')}</div>
|
||||
{requestBody && <div className='network-request-details-header'>Request Body</div>}
|
||||
@ -135,6 +134,14 @@ const BodyTab: React.FunctionComponent<{
|
||||
</div>;
|
||||
};
|
||||
|
||||
function statusClass(statusCode: number): string {
|
||||
if (statusCode < 300 || statusCode === 304)
|
||||
return 'green-circle';
|
||||
if (statusCode < 400)
|
||||
return 'yellow-circle';
|
||||
return 'red-circle';
|
||||
}
|
||||
|
||||
function formatBody(body: string | null, contentType: string): string {
|
||||
if (body === null)
|
||||
return 'Loading...';
|
||||
|
Loading…
Reference in New Issue
Block a user