package utils import ( "encoding/json" "net/http" ) func RespondJSON(w http.ResponseWriter, status int, object interface{}) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(status) if err := json.NewEncoder(w).Encode(object); err != nil { w.WriteHeader(http.StatusInternalServerError) } } func ClearCookie(w http.ResponseWriter, name string, secure bool) { http.SetCookie(w, &http.Cookie{ Name: name, Value: "", Path: "/", Secure: secure, HttpOnly: true, }) }