Skip to content

Commit

Permalink
Refactor: Move SSE header setup to setSSEHeader function in `chat_m…
Browse files Browse the repository at this point in the history
…ain_handler.go`
  • Loading branch information
swuecho committed Sep 11, 2024
1 parent f232c20 commit e39138d
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions api/chat_main_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,7 @@ func (h *ChatHandler) chatStream(w http.ResponseWriter, chatSession sqlc_queries
}
defer stream.Close()

// setSSEHeader(w)
w.Header().Set("Content-Type", "text/event-stream")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
setSSEHeader(w)

flusher, ok := w.(http.Flusher)
if !ok {
Expand Down

0 comments on commit e39138d

Please sign in to comment.