refactor: replace custom array search utility with slices.Contains for improved readability and performance.

This commit is contained in:
Miroslav Šedivý
2026-08-04 12:49:38 +02:00
parent d2ec13a236
commit db8452416b
6 changed files with 18 additions and 32 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"io"
"net/http"
"slices"
"strings"
"github.com/m1k1o/neko/server/pkg/types"
@@ -55,7 +56,7 @@ func (b *batchHandler) Handle(w http.ResponseWriter, r *http.Request) error {
continue
}
if exists, _ := utils.ArrayIn(request.Path, b.Excluded); exists {
if slices.Contains(b.Excluded, request.Path) {
res.Error(utils.HttpBadRequest("this path is excluded from batch requests"))
responses[i] = res
continue