Skip to content

Commit

Permalink
refact code
Browse files Browse the repository at this point in the history
  • Loading branch information
jhunters committed Apr 1, 2024
1 parent 8fa45c1 commit 07ad516
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions web/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ func EventStreamHandler(onEvent func(*http.Request, chan<- string)) func(http.Re
}

// 设置响应头信息
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(HTTP_HEADER_CONTENT_TYPE, HTTP_HEADER_CONTENT_TYPE_ES)
w.Header().Set(HTTP_HEADER_CACHE_CONTROL, HTTP_HEADER_CONTENT_Control_NO_CACHE)
w.Header().Set(HTTP_HEADER_CONNECTION, HTTP_HEADER_KEEPALIVE)
w.Header().Set(HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, "*")

// 创建字符串通道
ch := make(chan string)
Expand Down

0 comments on commit 07ad516

Please sign in to comment.