mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Nicer coloring for HTTP response codes.
20x: green 30x: blue 40x: orange 50x: light red other (non-standard or uncommon): dark red
This commit is contained in:
parent
c02fdb2463
commit
bb03255da0
@ -137,17 +137,17 @@ def raw_format_flow(f, focus, extended, padding):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if f["resp_code"]:
|
if f["resp_code"]:
|
||||||
if f["resp_code"] in [200, 304]:
|
codes = {
|
||||||
resp.append(fcol(SYMBOL_RETURN, "goodcode"))
|
2: "code_200",
|
||||||
else:
|
3: "code_300",
|
||||||
resp.append(fcol(SYMBOL_RETURN, "error"))
|
4: "code_400",
|
||||||
|
5: "code_500",
|
||||||
|
}
|
||||||
|
ccol = codes.get(f["resp_code"]/100, "code_other")
|
||||||
|
resp.append(fcol(SYMBOL_RETURN, ccol))
|
||||||
if f["resp_is_replay"]:
|
if f["resp_is_replay"]:
|
||||||
resp.append(fcol(SYMBOL_REPLAY, "replay"))
|
resp.append(fcol(SYMBOL_REPLAY, "replay"))
|
||||||
if f["resp_code"] in [200, 304]:
|
resp.append(fcol(f["resp_code"], ccol))
|
||||||
resp.append(fcol(f["resp_code"], "goodcode"))
|
|
||||||
else:
|
|
||||||
resp.append(fcol(f["resp_code"], "error"))
|
|
||||||
|
|
||||||
if f["intercepting"] and f["resp_code"] and not f["resp_acked"]:
|
if f["intercepting"] and f["resp_code"] and not f["resp_acked"]:
|
||||||
rc = "intercept"
|
rc = "intercept"
|
||||||
else:
|
else:
|
||||||
|
@ -33,8 +33,15 @@ dark = [
|
|||||||
# List and Connections
|
# List and Connections
|
||||||
('method', 'dark cyan', 'default'),
|
('method', 'dark cyan', 'default'),
|
||||||
('focus', 'yellow', 'default'),
|
('focus', 'yellow', 'default'),
|
||||||
('goodcode', 'light green', 'default'),
|
|
||||||
|
('code_200', 'light green', 'default'),
|
||||||
|
('code_300', 'light blue', 'default'),
|
||||||
|
('code_400', 'light red', 'default', None, "#f60", "default"),
|
||||||
|
('code_500', 'light red', 'default'),
|
||||||
|
('code_other', 'dark red', 'default'),
|
||||||
|
|
||||||
('error', 'light red', 'default'),
|
('error', 'light red', 'default'),
|
||||||
|
|
||||||
('header', 'dark cyan', 'default'),
|
('header', 'dark cyan', 'default'),
|
||||||
('highlight', 'white,bold', 'default'),
|
('highlight', 'white,bold', 'default'),
|
||||||
('intercept', 'brown', 'default', None, "#f60", "default"),
|
('intercept', 'brown', 'default', None, "#f60", "default"),
|
||||||
|
Loading…
Reference in New Issue
Block a user