mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdhttp: use correct http status const when writing http error
This commit is contained in:
parent
4f47a6ebfb
commit
bc61056912
@ -208,7 +208,7 @@ func (sh *authHandler) forRole(w http.ResponseWriter, r *http.Request, role stri
|
||||
return
|
||||
}
|
||||
if in.Role != role {
|
||||
writeError(w, httptypes.NewHTTPError(401, "Role JSON name does not match the name in the URL"))
|
||||
writeError(w, httptypes.NewHTTPError(http.StatusBadRequest, "Role JSON name does not match the name in the URL"))
|
||||
return
|
||||
}
|
||||
newrole, created, err := sh.sec.CreateOrUpdateRole(in)
|
||||
@ -315,7 +315,7 @@ func (sh *authHandler) forUser(w http.ResponseWriter, r *http.Request, user stri
|
||||
return
|
||||
}
|
||||
if u.User != user {
|
||||
writeError(w, httptypes.NewHTTPError(400, "User JSON name does not match the name in the URL"))
|
||||
writeError(w, httptypes.NewHTTPError(http.StatusBadRequest, "User JSON name does not match the name in the URL"))
|
||||
return
|
||||
}
|
||||
newuser, created, err := sh.sec.CreateOrUpdateUser(u)
|
||||
|
Loading…
x
Reference in New Issue
Block a user