counter: fix decrement-by

This commit is contained in:
Chris Sexton 2023-10-04 10:22:17 -04:00
parent f18154be5b
commit c44ada3061
1 changed files with 2 additions and 0 deletions

View File

@ -45,6 +45,8 @@ func (p *CounterPlugin) mkIncrementByNAPI(direction int) func(w http.ResponseWri
delta, err := strconv.Atoi(chi.URLParam(r, "delta"))
if err != nil || delta == 0 {
delta = direction
} else {
delta = delta * direction
}
secret, pass, ok := r.BasicAuth()