chore(server): replace 404 with 401 for unsupported routes and methods
This commit is contained in:
@@ -34,24 +34,24 @@ func (h *openvpnHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
case http.MethodPut:
|
||||
h.setStatus(w, r)
|
||||
default:
|
||||
http.Error(w, "", http.StatusNotFound)
|
||||
http.Error(w, "method "+r.Method+" not supported", http.StatusBadRequest)
|
||||
}
|
||||
case "/settings":
|
||||
switch r.Method {
|
||||
case http.MethodGet:
|
||||
h.getSettings(w)
|
||||
default:
|
||||
http.Error(w, "", http.StatusNotFound)
|
||||
http.Error(w, "method "+r.Method+" not supported", http.StatusBadRequest)
|
||||
}
|
||||
case "/portforwarded":
|
||||
switch r.Method {
|
||||
case http.MethodGet:
|
||||
h.getPortForwarded(w)
|
||||
default:
|
||||
http.Error(w, "", http.StatusNotFound)
|
||||
http.Error(w, "method "+r.Method+" not supported", http.StatusBadRequest)
|
||||
}
|
||||
default:
|
||||
http.Error(w, "", http.StatusNotFound)
|
||||
http.Error(w, "route "+r.RequestURI+" not supported", http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user