Browse Source

Merge pull request #3022 from xiang90/aut_type

etcdhttp: fix the response type for auth
Xiang Li 10 years ago
parent
commit
3e4479b0cd
1 changed files with 2 additions and 2 deletions
  1. 2 2
      etcdserver/etcdhttp/client_auth.go

+ 2 - 2
etcdserver/etcdhttp/client_auth.go

@@ -185,10 +185,10 @@ func (sh *authHandler) forRole(w http.ResponseWriter, r *http.Request, role stri
 		return
 	}
 	w.Header().Set("X-Etcd-Cluster-ID", sh.cluster.ID().String())
+	w.Header().Set("Content-Type", "application/json")
 
 	switch r.Method {
 	case "GET":
-		w.Header().Set("Content-Type", "application/json")
 		data, err := sh.sec.GetRole(role)
 		if err != nil {
 			writeError(w, err)
@@ -290,10 +290,10 @@ func (sh *authHandler) forUser(w http.ResponseWriter, r *http.Request, user stri
 		return
 	}
 	w.Header().Set("X-Etcd-Cluster-ID", sh.cluster.ID().String())
+	w.Header().Set("Content-Type", "application/json")
 
 	switch r.Method {
 	case "GET":
-		w.Header().Set("Content-Type", "application/json")
 		u, err := sh.sec.GetUser(user)
 		if err != nil {
 			writeError(w, err)