refactor ngin to rest

This commit is contained in:
kim
2020-07-31 17:03:19 +08:00
parent b73684d9a6
commit cf8e0a118f
10 changed files with 34 additions and 37 deletions

View File

@@ -7,6 +7,15 @@ import (
"zero/core/logx"
)
func Error(w http.ResponseWriter, err error) {
http.Error(w, err.Error(), http.StatusBadRequest)
}
func Ok(w http.ResponseWriter) {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.WriteHeader(http.StatusOK)
}
func OkJson(w http.ResponseWriter, v interface{}) {
WriteJson(w, http.StatusOK, v)
}