MCPcopy
hub / github.com/bettercap/bettercap / toJSON

Method toJSON

modules/api_rest/api_rest_controller.go:41–46  ·  view source on GitHub ↗
(w http.ResponseWriter, o interface{})

Source from the content-addressed store, hash-verified

39}
40
41func (mod *RestAPI) toJSON(w http.ResponseWriter, o interface{}) {
42 w.Header().Set("Content-Type", "application/json")
43 if err := json.NewEncoder(w).Encode(o); err != nil {
44 mod.Debug("error while encoding object to JSON: %v", err)
45 }
46}
47
48func (mod *RestAPI) setSecurityHeaders(w http.ResponseWriter) {
49 w.Header().Add("X-Frame-Options", "DENY")

Callers 15

showSessionMethod · 0.95
showBLEMethod · 0.95
showHIDMethod · 0.95
showEnvMethod · 0.95
showGatewayMethod · 0.95
showInterfaceMethod · 0.95
showModulesMethod · 0.95
showLANMethod · 0.95
showOptionsMethod · 0.95
showPacketsMethod · 0.95
showStartedAtMethod · 0.95
showWiFiMethod · 0.95

Calls 4

HeaderMethod · 0.80
EncodeMethod · 0.80
SetMethod · 0.45
DebugMethod · 0.45

Tested by 1

TestToJSONFunction · 0.76