MCPcopy
hub / github.com/bettercap/bettercap / dumpJSON

Method dumpJSON

modules/events_stream/events_view_http.go:110–121  ·  view source on GitHub ↗
(body []byte)

Source from the content-addressed store, hash-verified

108}
109
110func (mod *EventsStream) dumpJSON(body []byte) string {
111 var buf bytes.Buffer
112 var pretty string
113
114 if err := json.Indent(&buf, body, "", " "); err != nil {
115 pretty = string(body)
116 } else {
117 pretty = buf.String()
118 }
119
120 return "\n" + reJsonKey.ReplaceAllString(pretty, tui.Green(`$1:`)) + "\n"
121}
122
123func (mod *EventsStream) dumpXML(body []byte) string {
124 // TODO: indent xml

Callers 2

viewHttpRequestMethod · 0.95
viewHttpResponseMethod · 0.95

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected