revocation

This commit is contained in:
Livio Amstutz 2021-10-28 07:40:06 +02:00
parent 9721c25336
commit d0b8dfe340
2 changed files with 8 additions and 10 deletions

View file

@ -14,6 +14,9 @@ func MarshalJSON(w http.ResponseWriter, i interface{}) {
func MarshalJSONWithStatus(w http.ResponseWriter, i interface{}, status int) {
w.Header().Set("content-type", "application/json")
w.WriteHeader(status)
if i == nil {
return
}
err := json.NewEncoder(w).Encode(i)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)