mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdhttp: DELETE on members = MethodNotAllowed
This commit is contained in:
parent
387639e802
commit
e849d8e157
@ -205,6 +205,10 @@ func (h *adminMembersHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
case "DELETE":
|
||||
idStr := trimPrefix(r.URL.Path, adminMembersPrefix)
|
||||
if idStr == "" {
|
||||
http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
id, err := strconv.ParseUint(idStr, 16, 64)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
|
@ -779,6 +779,16 @@ func TestServeAdminMembersFail(t *testing.T) {
|
||||
|
||||
http.StatusInternalServerError,
|
||||
},
|
||||
{
|
||||
// etcdserver.RemoveMember error
|
||||
&http.Request{
|
||||
URL: mustNewURL(t, adminMembersPrefix),
|
||||
Method: "DELETE",
|
||||
},
|
||||
nil,
|
||||
|
||||
http.StatusMethodNotAllowed,
|
||||
},
|
||||
}
|
||||
for i, tt := range tests {
|
||||
h := &adminMembersHandler{
|
||||
|
Loading…
x
Reference in New Issue
Block a user