Rename WriteErrorResponse() to simply ErrorJSON() and reorder arguments

This way we better mimic net/http.Error()

https://pkg.go.dev/net/http?tab=doc#Error
This commit is contained in:
pancho horrillo
2019-11-20 07:37:35 +01:00
parent 7ea43048bc
commit 0d66fe9963
6 changed files with 41 additions and 39 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ func checkHandler(fn resourceHandler) func(http.ResponseWriter, *http.Request) {
if h, ok := Handlers.Get(handlerID); ok {
fn(w, r, h)
} else {
srverrors.WriteErrorResponse(http.StatusNotFound, "Handler ID Not Found", w)
srverrors.ErrorJSON(w, "Handler ID Not Found", http.StatusNotFound)
}
}
}