mirror of
https://github.com/bettercap/bettercap
synced 2025-07-15 01:23:42 -07:00
fix: /api/events n parameter did not work as expected (fixes #158)
This commit is contained in:
parent
2b94fb9e83
commit
5e6741d544
1 changed files with 3 additions and 2 deletions
|
@ -180,7 +180,8 @@ func (api *RestAPI) showEvents(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
events := session.I.Events.Sorted()
|
events := session.I.Events.Sorted()
|
||||||
nmax := len(events)
|
nevents := len(events)
|
||||||
|
nmax := nevents
|
||||||
n := nmax
|
n := nmax
|
||||||
|
|
||||||
q := r.URL.Query()
|
q := r.URL.Query()
|
||||||
|
@ -196,7 +197,7 @@ func (api *RestAPI) showEvents(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toJSON(w, events[0:n])
|
toJSON(w, events[nevents-n:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue