Write header before sending data

This commit is contained in:
Torjus Håkestad 2021-04-12 08:16:23 +02:00
parent 274590c837
commit a264ce76ed

View File

@ -152,6 +152,7 @@ func (s *Server) HandlerAttemptStream(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Origin", "*")
id, ch := s.addAttemptListener() id, ch := s.addAttemptListener()
defer s.closeAttemptListener(id) defer s.closeAttemptListener(id)
w.WriteHeader(http.StatusOK)
flusher := w.(http.Flusher) flusher := w.(http.Flusher)
ticker := time.NewTicker(30 * time.Second) ticker := time.NewTicker(30 * time.Second)