aboutsummaryrefslogtreecommitdiff
path: root/http_server_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-12-03 00:38:56 +0700
committerShulhan <ms@kilabit.info>2023-12-04 00:20:30 +0700
commit775af78cc6c8ebe9e258b81dd9442bbe6b8b36d4 (patch)
tree32a0b89c46840225a20532bd2e14151ef7c46250 /http_server_test.go
parent6300f75d5ed37059f79d52b6f3340f6643df33cf (diff)
downloadawwan-775af78cc6c8ebe9e258b81dd9442bbe6b8b36d4.tar.xz
all: write the output as is when sending with server-sent events
Previously, if the command output is "line1\n\nline2\n", the web output it as line1 line2 it should be line1 line2 This fix the empty line not displayed in wui output.
Diffstat (limited to 'http_server_test.go')
-rw-r--r--http_server_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/http_server_test.go b/http_server_test.go
index ce75997..7dcff3f 100644
--- a/http_server_test.go
+++ b/http_server_test.go
@@ -305,7 +305,7 @@ func TestHttpServer_Execute(t *testing.T) {
fmt.Fprintf(&buf, "event: %s\n", ev.Type)
}
if len(ev.Data) != 0 {
- fmt.Fprintf(&buf, "data: %s\n", ev.Data)
+ fmt.Fprintf(&buf, "data: %q\n", ev.Data)
}
if len(ev.ID) != 0 {
fmt.Fprintf(&buf, "id: %s\n", ev.ID)