Browse Source

httptypes: set headers before call to WriteHeader

Brian Waldon 11 years ago
parent
commit
6f851ac885
1 changed files with 1 additions and 1 deletions
  1. 1 1
      etcdserver/etcdhttp/httptypes/errors.go

+ 1 - 1
etcdserver/etcdhttp/httptypes/errors.go

@@ -33,8 +33,8 @@ func (e HTTPError) Error() string {
 
 // TODO(xiangli): handle http write errors
 func (e HTTPError) WriteTo(w http.ResponseWriter) {
-	w.WriteHeader(e.Code)
 	w.Header().Set("Content-Type", "application/json")
+	w.WriteHeader(e.Code)
 	b, err := json.Marshal(e)
 	if err != nil {
 		panic("unexpected json marshal error")