From 997b20a9756de2a02395209da5eb9b1eaa694f66 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Tue, 19 Aug 2014 23:30:32 +0100 Subject: [PATCH] Set Content-Type before sending out headers --- cmd/syncthing/gui.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index 598e1e21d..d21e43bb4 100644 --- a/cmd/syncthing/gui.go +++ b/cmd/syncthing/gui.go @@ -459,6 +459,8 @@ func restGetEvents(w http.ResponseWriter, r *http.Request) { since, _ := strconv.Atoi(sinceStr) limit, _ := strconv.Atoi(limitStr) + w.Header().Set("Content-Type", "application/json; charset=utf-8") + // Flush before blocking, to indicate that we've received the request // and that it should not be retried. f := w.(http.Flusher) @@ -469,7 +471,6 @@ func restGetEvents(w http.ResponseWriter, r *http.Request) { evs = evs[len(evs)-limit:] } - w.Header().Set("Content-Type", "application/json; charset=utf-8") json.NewEncoder(w).Encode(evs) }