From c01c94c64c3aef98ee4cb31f1c3fe24a70133756 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Sun, 7 Nov 2021 13:08:03 -0500 Subject: [PATCH] Fix content type to add charset --- server/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/server.go b/server/server.go index bbde7341..526a668a 100644 --- a/server/server.go +++ b/server/server.go @@ -228,7 +228,7 @@ func (s *Server) handleSubscribeJSON(w http.ResponseWriter, r *http.Request, v * } return buf.String(), nil } - return s.handleSubscribe(w, r, v, "json", "application/stream+json", encoder) + return s.handleSubscribe(w, r, v, "json", "application/x-ndjson", encoder) } func (s *Server) handleSubscribeSSE(w http.ResponseWriter, r *http.Request, v *visitor) error { @@ -282,8 +282,8 @@ func (s *Server) handleSubscribe(w http.ResponseWriter, r *http.Request, v *visi } return nil } - w.Header().Set("Access-Control-Allow-Origin", "*") // CORS, allow cross-origin requests - w.Header().Set("Content-Type", contentType) + w.Header().Set("Access-Control-Allow-Origin", "*") // CORS, allow cross-origin requests + w.Header().Set("Content-Type", contentType+"; charset=utf-8") // Android/Volley client needs charset! if poll { return s.sendOldMessages(t, since, sub) }