mirror of https://github.com/velour/catbase.git
counter: fix decrement-by
This commit is contained in:
parent
f18154be5b
commit
c44ada3061
|
@ -45,6 +45,8 @@ func (p *CounterPlugin) mkIncrementByNAPI(direction int) func(w http.ResponseWri
|
||||||
delta, err := strconv.Atoi(chi.URLParam(r, "delta"))
|
delta, err := strconv.Atoi(chi.URLParam(r, "delta"))
|
||||||
if err != nil || delta == 0 {
|
if err != nil || delta == 0 {
|
||||||
delta = direction
|
delta = direction
|
||||||
|
} else {
|
||||||
|
delta = delta * direction
|
||||||
}
|
}
|
||||||
|
|
||||||
secret, pass, ok := r.BasicAuth()
|
secret, pass, ok := r.BasicAuth()
|
||||||
|
|
Loading…
Reference in New Issue