From 1e47f911f1facd709a868965c015b8a02917ad5b Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 22 Mar 2025 11:06:00 +0800 Subject: Strip trailing \n too --- conn.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conn.go b/conn.go index 1cd8492..c84fc5d 100644 --- a/conn.go +++ b/conn.go @@ -24,6 +24,9 @@ func (c *Conn) ReadMessage() (msg Message, line string, err error) { return } + if raw[len(raw) - 1] == '\n' { + raw = raw[:len(raw) - 1] + } if raw[len(raw) - 1] == '\r' { raw = raw[:len(raw) - 1] } -- cgit v1.2.3