Skip to content

Commit

Permalink
handle write err
Browse files Browse the repository at this point in the history
  • Loading branch information
x0ddf committed Feb 9, 2025
1 parent 7aafafe commit a2d6325
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion controllers/admission_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ func (ac *AdmissionController) Handle(w http.ResponseWriter, r *http.Request) {
}

w.Header().Set("Content-Type", "application/json")
w.Write(resp)
if _, err := w.Write(resp); err != nil {
http.Error(w, fmt.Sprintf("fail to write response:% v", err), http.StatusInternalServerError)
}
}

// escapeJSONPointer escapes / in label names for JSON Pointer compliance
Expand Down

0 comments on commit a2d6325

Please sign in to comment.