From 93c7f9f18eafb68ff892a2ecb3de25d8a56d3e84 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 24 Nov 2023 21:45:41 +0700 Subject: http/sseclient: remove double check for non-empty packet Let the parseEvent handle and check for empty packet. --- lib/http/sseclient/sseclient.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/http') diff --git a/lib/http/sseclient/sseclient.go b/lib/http/sseclient/sseclient.go index 71bef4c0..ed799114 100644 --- a/lib/http/sseclient/sseclient.go +++ b/lib/http/sseclient/sseclient.go @@ -125,11 +125,9 @@ func (cl *Client) Connect(header http.Header) (err error) { default: } - if len(packet) != 0 { - // The HTTP response may contains events in the body, - // consume it. - cl.parseEvent(packet) - } + // The HTTP response may contains events in the body, + // consume it. + cl.parseEvent(packet) go cl.consume() -- cgit v1.3-6-g1900