diff options
| author | Shulhan <ms@kilabit.info> | 2023-12-03 00:30:41 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-12-03 00:30:50 +0700 |
| commit | 7ac80e78ee29643765e9d90d40914b36a7c21479 (patch) | |
| tree | 983b92fb3dc6ce75125724b225809c6e73804992 | |
| parent | 635cdf86fcfdef46f708c32467a5bd578a96baf7 (diff) | |
| download | pakakeh.go-7ac80e78ee29643765e9d90d40914b36a7c21479.tar.xz | |
http/sseclient: add test for multi lines with empty line in middle
When running the EventSource client in Firefox, we found out that when
server send a multi line content with empty line in the middle, the empty
line is ignored by Firefox.
Just to make sure we test it here and the server send it as expected
event:message\ndata:line 1\ndata:\ndata:line2\ndata:\ndata:\n\n
This case is similar with case number 3 when testing raw data.
So probably this is bug in our implementation of SSE in another project.
| -rw-r--r-- | lib/http/sseclient/sseclient_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/http/sseclient/sseclient_test.go b/lib/http/sseclient/sseclient_test.go index 785eac78..bf40d0b2 100644 --- a/lib/http/sseclient/sseclient_test.go +++ b/lib/http/sseclient/sseclient_test.go @@ -48,6 +48,14 @@ func TestClient(t *testing.T) { Data: "Hello\nmulti\nline\nworld", }, }, { + kind: EventTypeMessage, + data: "line 1\n\nline2\n\n", + id: fnoid, + exp: Event{ + Type: EventTypeMessage, + Data: "line 1\n\nline2\n\n", + }, + }, { kind: `join`, data: `John join the event`, id: fnoid, |
