Set Content-Type before sending out headers
This commit is contained in:
parent
386f9c42c2
commit
997b20a975
|
@ -459,6 +459,8 @@ func restGetEvents(w http.ResponseWriter, r *http.Request) {
|
||||||
since, _ := strconv.Atoi(sinceStr)
|
since, _ := strconv.Atoi(sinceStr)
|
||||||
limit, _ := strconv.Atoi(limitStr)
|
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
|
// Flush before blocking, to indicate that we've received the request
|
||||||
// and that it should not be retried.
|
// and that it should not be retried.
|
||||||
f := w.(http.Flusher)
|
f := w.(http.Flusher)
|
||||||
|
@ -469,7 +471,6 @@ func restGetEvents(w http.ResponseWriter, r *http.Request) {
|
||||||
evs = evs[len(evs)-limit:]
|
evs = evs[len(evs)-limit:]
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
|
||||||
json.NewEncoder(w).Encode(evs)
|
json.NewEncoder(w).Encode(evs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue