Browse Source

Merge pull request #2518 from xiang90/security_write_error

etcdserver/etcdhttp: write the http error to response writer
Xiang Li 10 years ago
parent
commit
8a589d11d5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      etcdserver/etcdhttp/client_security.go

+ 2 - 2
etcdserver/etcdhttp/client_security.go

@@ -185,7 +185,7 @@ func (sh *securityHandler) forRole(w http.ResponseWriter, r *http.Request, role
 			return
 		}
 		if in.Role != role {
-			httptypes.NewHTTPError(400, "Role JSON name does not match the name in the URL")
+			writeError(w, httptypes.NewHTTPError(400, "Role JSON name does not match the name in the URL"))
 			return
 		}
 		newrole, err := sh.sec.CreateOrUpdateRole(in)
@@ -280,7 +280,7 @@ func (sh *securityHandler) forUser(w http.ResponseWriter, r *http.Request, user
 			return
 		}
 		if u.User != user {
-			httptypes.NewHTTPError(400, "User JSON name does not match the name in the URL")
+			writeError(w, httptypes.NewHTTPError(400, "User JSON name does not match the name in the URL"))
 			return
 		}
 		newuser, err := sh.sec.CreateOrUpdateUser(u)