write errors with proper go api

This commit is contained in:
Andre Medeiros 2021-08-14 13:57:26 -04:00
parent 282ff6ef3e
commit 7f8d0c3375

View file

@ -4,6 +4,5 @@ import "net/http"
func (a *api) errorResponse(w http.ResponseWriter, r *http.Request, status int, message string) { func (a *api) errorResponse(w http.ResponseWriter, r *http.Request, status int, message string) {
w.Header().Set("X-Apollo-Error", message) w.Header().Set("X-Apollo-Error", message)
w.WriteHeader(status) http.Error(w, message, status)
w.Write([]byte(message))
} }