1
0
Эх сурвалжийг харах

Return correct content type for /rest/events

Jakob Borg 9 жил өмнө
parent
commit
a7a9d7d85c
1 өөрчлөгдсөн 4 нэмэгдсэн , 2 устгасан
  1. 4 2
      cmd/syncthing/gui.go

+ 4 - 2
cmd/syncthing/gui.go

@@ -893,8 +893,10 @@ func (s *apiService) getEvents(w http.ResponseWriter, r *http.Request) {
 
 	s.fss.gotEventRequest()
 
-	// Flush before blocking, to indicate that we've received the request
-	// and that it should not be retried.
+	// Flush before blocking, to indicate that we've received the request and
+	// that it should not be retried. Must set Content-Type header before
+	// flushing.
+	w.Header().Set("Content-Type", "application/json; charset=utf-8")
 	f := w.(http.Flusher)
 	f.Flush()