1
0
mirror of https://github.com/golang/go synced 2024-11-17 05:54:46 -07:00

separate condition

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
This commit is contained in:
Ignacio Hagopian 2020-10-08 17:31:27 -03:00
parent c817183043
commit efc019a9fe
No known key found for this signature in database
GPG Key ID: 4DC349E20B2AD1BE

View File

@ -402,11 +402,15 @@ func (p *ReverseProxy) flushInterval(res *http.Response) time.Duration {
// For Server-Sent Events responses, flush immediately.
// The MIME type is defined in https://www.w3.org/TR/eventsource/#text-event-stream
// We might have the case of streaming for which Content-Length might be unset.
if resCT == "text/event-stream" || res.ContentLength == -1 {
if resCT == "text/event-stream" {
return -1 // negative means immediately
}
// We might have the case of streaming for which Content-Length might be unset.
if res.ContentLength == -1 {
return -1
}
return p.FlushInterval
}