mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Merge pull request #3351 from arun-94/master
#3312 Change colors according to the HTTP status code
This commit is contained in:
commit
e8d76d050d
@ -109,6 +109,11 @@ exports[`FlowColumns Components should render SizeColumn 1`] = `
|
||||
exports[`FlowColumns Components should render StatusColumn 1`] = `
|
||||
<td
|
||||
className="col-status"
|
||||
style={
|
||||
Object {
|
||||
"color": "darkred",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
|
@ -30,6 +30,11 @@ exports[`FlowRow Component should render correctly 1`] = `
|
||||
</td>
|
||||
<td
|
||||
className="col-status"
|
||||
style={
|
||||
Object {
|
||||
"color": "darkgreen",
|
||||
}
|
||||
}
|
||||
>
|
||||
200
|
||||
</td>
|
||||
|
@ -90,8 +90,26 @@ MethodColumn.headerClass = 'col-method'
|
||||
MethodColumn.headerName = 'Method'
|
||||
|
||||
export function StatusColumn({ flow }) {
|
||||
let color = 'darkred';
|
||||
|
||||
if (flow.response !== null && 100 <= flow.response.status_code && flow.response.status_code < 200) {
|
||||
color = 'green'
|
||||
}
|
||||
else if (flow.response !== null && 200 <= flow.response.status_code && flow.response.status_code < 300) {
|
||||
color = 'darkgreen'
|
||||
}
|
||||
else if (flow.response !== null && 300 <= flow.response.status_code && flow.response.status_code < 400) {
|
||||
color = 'lightblue'
|
||||
}
|
||||
else if (flow.response !== null && 400 <= flow.response.status_code && flow.response.status_code < 500) {
|
||||
color = 'lightred'
|
||||
}
|
||||
else if (flow.response !== null && 500 <= flow.response.status_code && flow.response.status_code < 600) {
|
||||
color = 'lightred'
|
||||
}
|
||||
|
||||
return (
|
||||
<td className="col-status">{flow.response && flow.response.status_code}</td>
|
||||
<td className="col-status" style={{color: color}}>{flow.response && flow.response.status_code}</td>
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user