From 6f851ac88547ef3f1a19af2fc8e5d3f325925393 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Tue, 28 Oct 2014 11:08:10 -0700 Subject: [PATCH] httptypes: set headers before call to WriteHeader --- etcdserver/etcdhttp/httptypes/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etcdserver/etcdhttp/httptypes/errors.go b/etcdserver/etcdhttp/httptypes/errors.go index 666a27f44..548cf8ffd 100644 --- a/etcdserver/etcdhttp/httptypes/errors.go +++ b/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")