diff --git a/main.go b/main.go index 648186e..8a52606 100644 --- a/main.go +++ b/main.go @@ -29,11 +29,7 @@ type StreamResponse struct { const linux = "python3" -func streamResponse(w http.ResponseWriter, fromLanguage, toLanguage string, messages <-chan string) { - w.Header().Set("Content-Type", "application/json; charset=utf-8") - w.Header().Set("Cache-Control", "no-cache") - w.Header().Set("Connection", "keep-alive") - +func createStreamResponse(fromLanguage, toLanguage, message string) string { response := StreamResponse{ From: fromLanguage, To: toLanguage, @@ -48,7 +44,7 @@ func streamResponse(w http.ResponseWriter, fromLanguage, toLanguage string, mess } func streamResponse(w http.ResponseWriter, fromLanguage, toLanguage string, messages <-chan string) { - w.Header().Set("Content-Type", "text/event-stream") + w.Header().Set("Content-Type", "application/json; charset=utf-8") w.Header().Set("Cache-Control", "no-cache") w.Header().Set("Connection", "keep-alive")