mirror of
https://github.com/bettercap/bettercap
synced 2025-07-07 13:32:07 -07:00
fix: fixed a json encoding issue that caused the api.rest controller to return an empty list of events when a net.sniff http event is triggered
This commit is contained in:
parent
7b7739358d
commit
0ada0fdf7b
4 changed files with 46 additions and 16 deletions
|
@ -40,7 +40,9 @@ func setSecurityHeaders(w http.ResponseWriter) {
|
|||
|
||||
func toJSON(w http.ResponseWriter, o interface{}) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(o)
|
||||
if err := json.NewEncoder(w).Encode(o); err != nil {
|
||||
log.Error("error while encoding object to JSON: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (api *RestAPI) checkAuth(r *http.Request) bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue