etcdhttp: DELETE on members = MethodNotAllowed

This commit is contained in:
Jonathan Boulle 2014-10-27 10:07:19 -07:00 committed by Brian Waldon
parent 387639e802
commit e849d8e157
2 changed files with 14 additions and 0 deletions

View File

@ -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)

View File

@ -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{