1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-12-23 18:23:27 +01:00

Fix content type to add charset

This commit is contained in:
Philipp Heckel 2021-11-07 13:08:03 -05:00
parent 7adb0e4f2f
commit c01c94c64c

View file

@ -228,7 +228,7 @@ func (s *Server) handleSubscribeJSON(w http.ResponseWriter, r *http.Request, v *
} }
return buf.String(), nil 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 { func (s *Server) handleSubscribeSSE(w http.ResponseWriter, r *http.Request, v *visitor) error {
@ -283,7 +283,7 @@ func (s *Server) handleSubscribe(w http.ResponseWriter, r *http.Request, v *visi
return nil return nil
} }
w.Header().Set("Access-Control-Allow-Origin", "*") // CORS, allow cross-origin requests w.Header().Set("Access-Control-Allow-Origin", "*") // CORS, allow cross-origin requests
w.Header().Set("Content-Type", contentType) w.Header().Set("Content-Type", contentType+"; charset=utf-8") // Android/Volley client needs charset!
if poll { if poll {
return s.sendOldMessages(t, since, sub) return s.sendOldMessages(t, since, sub)
} }