diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e963db8..a430b9cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ## 3.6.0 (unreleased) +- [PR #195](https://github.com/rqlite/rqlite/pull/195): Set Content-type "application/json" on all HTTP responses. - [PR #193](https://github.com/rqlite/rqlite/pull/193): Allow joining a cluster through any node, not just the leader. - [PR #187](https://github.com/rqlite/rqlite/pull/187): Support memory profiling. - Go cyclo complexity changes. diff --git a/http/service.go b/http/service.go index b0ca6cfc..a933e16f 100644 --- a/http/service.go +++ b/http/service.go @@ -200,6 +200,7 @@ func (s *Service) Close() { // ServeHTTP allows Service to serve HTTP requests. func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=utf-8") s.addBuildVersion(w) if s.credentialStore != nil { @@ -627,7 +628,6 @@ func queriesValid(queries []string) bool { // serveExpvar serves registered expvar information over HTTP. func serveExpvar(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=utf-8") fmt.Fprintf(w, "{\n") first := true expvar.Do(func(kv expvar.KeyValue) {