mirror of
https://github.com/gin-gonic/gin.git
synced 2025-04-06 03:57:46 +08:00
Setting "Cache-Control" to "no-cache" in SSE
This commit is contained in:
parent
20213d6de3
commit
51a64abe86
@ -21,6 +21,9 @@ func WriteSSEvent(w http.ResponseWriter, eventName string, data interface{}) err
|
||||
if len(header.Get("Content-Type")) == 0 {
|
||||
header.Set("Content-Type", sse.ContentType)
|
||||
}
|
||||
if len(header.Get("Cache-Control")) == 0 {
|
||||
header.Set("Cache-Control", "no-cache")
|
||||
}
|
||||
return sse.Encode(w, sse.Event{
|
||||
Event: eventName,
|
||||
Data: data,
|
||||
|
Loading…
x
Reference in New Issue
Block a user