use json helper from common-lib HTTP helper
tronnet/workflows: Static Analysis -- Golang / static-go (push) Failing after 34s

This commit is contained in:
alu committed 2026-10-26 18:18:02 +00:00
1 parent 590486f153
commit 627a9e1bb6
3 files changed
+19 -32

No files matched your search

-14
View File
@@ -3,7 +3,6 @@ package app
import (
"encoding/json"
"log"
"net/http"
"os"
"strings"
)
@@ -64,16 +63,3 @@ func AnyPrefixes(s string, prefixes []string) string {
return ""
}
func WriteJson(w http.ResponseWriter, code int, obj any) {
w.Header().Set("Content-Type", "application/json")
json, err := json.Marshal(obj)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
} else {
w.WriteHeader(code)
w.Write(json)
return
}
}