From 89db1e89f130e29cfb1b5d8b22821b55621d56b0 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 22 Mar 2025 10:57:30 +0800 Subject: ReadMessage should return the raw line too --- conn.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conn.go b/conn.go index ac3787c..1cd8492 100644 --- a/conn.go +++ b/conn.go @@ -18,7 +18,7 @@ func NewConn(netConn net.Conn) Conn { } } -func (c *Conn) ReadMessage() (msg Message, err error) { +func (c *Conn) ReadMessage() (msg Message, line string, err error) { raw, err := c.bufReader.ReadSlice('\n') if err != nil { return @@ -28,7 +28,9 @@ func (c *Conn) ReadMessage() (msg Message, err error) { raw = raw[:len(raw) - 1] } - msg, err = Parse(slices.Clone(raw)) + lineBytes := slices.Clone(raw) + line = bytesToString(lineBytes) + msg, err = Parse(lineBytes) return } -- cgit v1.2.3