chore(server): replace 404 with 401 for unsupported routes and methods

This commit is contained in:
Quentin McGaw
2022-08-21 21:23:02 +00:00
parent f8bf32bb34
commit 54dcf28b31
6 changed files with 13 additions and 13 deletions

View File

@@ -28,7 +28,7 @@ type handlerV0 struct {
func (h *handlerV0) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
http.Error(w, "unversioned API: only supports GET method", http.StatusNotFound)
http.Error(w, "unversioned API: only supports GET method", http.StatusBadRequest)
return
}
switch r.RequestURI {
@@ -63,6 +63,6 @@ func (h *handlerV0) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.logger.Warn(err.Error())
}
default:
http.Error(w, "unversioned API: requested URI not found", http.StatusNotFound)
http.Error(w, "unversioned API: requested URI not found", http.StatusBadRequest)
}
}