(w http.ResponseWriter, code int, msg string)
| 11 | } |
| 12 | |
| 13 | func ErrorMessage(w http.ResponseWriter, code int, msg string) { |
| 14 | if code == 0 { |
| 15 | code = http.StatusInternalServerError |
| 16 | } |
| 17 | w.WriteHeader(code) |
| 18 | if _, err := w.Write([]byte(msg)); err != nil { |
| 19 | klog.Errorf("failed to write a error message to the response, err: %v", err) |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | func OK(w http.ResponseWriter, body []byte) { |
| 24 | w.WriteHeader(http.StatusOK) |