MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / prettify

Method prettify

mitmproxy/contentviews/_view_dns.py:16–26  ·  view source on GitHub ↗
(
        self,
        data: bytes,
        metadata: Metadata,
    )

Source from the content-addressed store, hash-verified

14 syntax_highlight = "yaml"
15
16 def prettify(
17 self,
18 data: bytes,
19 metadata: Metadata,
20 ) -> str:
21 if _is_dns_tcp(metadata):
22 data = data[2:] # hack: cut off length label and hope for the best
23 message = DNSMessage.unpack(data).to_json()
24 del message["status_code"]
25 message.pop("timestamp", None)
26 return yaml_dumps(message)
27
28 def reencode(
29 self,

Callers

nothing calls this directly

Calls 5

yaml_dumpsFunction · 0.90
_is_dns_tcpFunction · 0.85
unpackMethod · 0.80
to_jsonMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected