Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
8479e1d5
Commit
8479e1d5
authored
Apr 16, 2026
by
boojack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: close SSE response body explicitly
parent
a5ddd5ad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
sse_handler_test.go
server/router/api/v1/test/sse_handler_test.go
+7
-4
No files found.
server/router/api/v1/test/sse_handler_test.go
View file @
8479e1d5
...
...
@@ -86,9 +86,12 @@ func TestSSEHandler_Authentication(t *testing.T) {
require
.
NoError
(
t
,
err
)
req
.
Header
.
Set
(
"Authorization"
,
"Bearer "
+
token
)
resp
,
err
:=
server
.
Client
()
.
Do
(
req
)
require
.
NoError
(
t
,
err
)
defer
resp
.
Body
.
Close
()
resp
,
err
:=
server
.
Client
()
.
Do
(
req
)
//nolint:bodyclose // Body is closed after verifying the SSE stream disconnects.
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
body
:=
resp
.
Body
defer
body
.
Close
()
require
.
Equal
(
t
,
http
.
StatusOK
,
resp
.
StatusCode
)
require
.
Equal
(
t
,
"text/event-stream"
,
resp
.
Header
.
Get
(
"Content-Type"
))
...
...
@@ -96,7 +99,7 @@ func TestSSEHandler_Authentication(t *testing.T) {
done
:=
make
(
chan
error
,
1
)
go
func
()
{
_
,
err
:=
io
.
ReadAll
(
resp
.
B
ody
)
_
,
err
:=
io
.
ReadAll
(
b
ody
)
done
<-
err
}()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment