zitadel-oidc/pkg/utils/marshal.go
2019-11-18 15:37:48 +01:00

18 lines
361 B
Go

package utils
import (
"encoding/json"
"net/http"
"github.com/caos/utils/logging"
)
func MarshalJSON(w http.ResponseWriter, i interface{}) {
b, err := json.Marshal(i)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
_, err = w.Write(b)
logging.Log("UTILS-zVu9OW").OnError(err).Error("error writing response")
}