diff options
author | Arun Swaminathan <arunswaminathan94@gmail.com> | 2018-10-15 22:43:22 -0400 |
---|---|---|
committer | Arun Swaminathan <arunswaminathan94@gmail.com> | 2018-10-15 22:43:22 -0400 |
commit | 028dd78291fb7f630d42b22759b86a1b018380c5 (patch) | |
tree | 8b6cff36415c59a1cdafea0032f25d78d024d34d /web/src/js | |
parent | 57868ef5fab5c9f101126ec7981db2d769b22a4f (diff) | |
download | mitmproxy-028dd78291fb7f630d42b22759b86a1b018380c5.tar.gz mitmproxy-028dd78291fb7f630d42b22759b86a1b018380c5.tar.bz2 mitmproxy-028dd78291fb7f630d42b22759b86a1b018380c5.zip |
#3312 Change colors according to HTTP status code
Diffstat (limited to 'web/src/js')
-rw-r--r-- | web/src/js/components/FlowTable/FlowColumns.jsx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/web/src/js/components/FlowTable/FlowColumns.jsx b/web/src/js/components/FlowTable/FlowColumns.jsx index e60ed487..d16bdad2 100644 --- a/web/src/js/components/FlowTable/FlowColumns.jsx +++ b/web/src/js/components/FlowTable/FlowColumns.jsx @@ -90,8 +90,26 @@ MethodColumn.headerClass = 'col-method' MethodColumn.headerName = 'Method' export function StatusColumn({ flow }) { + let color = 'darkred'; + + if (100 <= flow.response.status_code && flow.response.status_code < 200) { + color = 'green' + } + else if (200 <= flow.response.status_code && flow.response.status_code < 300) { + color = 'darkgreen' + } + else if (300 <= flow.response.status_code && flow.response.status_code < 400) { + color = 'lightblue' + } + else if (400 <= flow.response.status_code && flow.response.status_code < 500) { + color = 'lightred' + } + else if (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> ) } |