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
@@ -38,7 +38,7 @@ func configRouter(rs []routeSpec) (r *mux.Router) {
r.HandleFunc(
"/handlers/{handlerID}/{resource:.*}",
func(w http.ResponseWriter, r *http.Request) {
srverrors.WriteErrorResponse(http.StatusBadRequest, "Invalid Resource Path", w)
srverrors.ErrorJSON(w, "Invalid Resource Path", http.StatusBadRequest)
})
return r
}