diff --git a/internal/handler/helpers.go b/internal/handler/helpers.go index 53cc66d..e7b7a39 100644 --- a/internal/handler/helpers.go +++ b/internal/handler/helpers.go @@ -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 -} diff --git a/internal/handler/node.go b/internal/handler/node.go index f53783a..dd89a10 100644 --- a/internal/handler/node.go +++ b/internal/handler/node.go @@ -763,9 +763,9 @@ func allowedOfficeFormat(format string) bool { } func subordinates(r *http.Request) []string { - ids := csvHeader(r, "X-User-Subordinates") + ids := commonmw.HeaderCSV(r, "X-User-Subordinates") if len(ids) == 0 { - ids = csvHeader(r, "X-User-Subordinate-Ids") + ids = commonmw.HeaderCSV(r, "X-User-Subordinate-Ids") } return ids }