chore: use common header parsing

This commit is contained in:
Grendgi
2026-06-17 13:54:04 +03:00
parent 1a84c04314
commit aad9fa1b4a
2 changed files with 2 additions and 19 deletions

View File

@@ -4,7 +4,6 @@ import (
"encoding/json"
"log/slog"
"net/http"
"strings"
)
func writeJSON(w http.ResponseWriter, status int, v any) {
@@ -26,19 +25,3 @@ func decodeJSON(r *http.Request, v any) error {
defer r.Body.Close()
return json.NewDecoder(r.Body).Decode(v)
}
func csvHeader(r *http.Request, key string) []string {
raw := r.Header.Get(key)
if raw == "" {
return nil
}
parts := strings.Split(raw, ",")
out := make([]string, 0, len(parts))
for _, p := range parts {
p = strings.TrimSpace(p)
if p != "" {
out = append(out, p)
}
}
return out
}