mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
httptypes: set headers before call to WriteHeader
This commit is contained in:
parent
2b4201c53d
commit
6f851ac885
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user