mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
The listener test copies a name out of the receive buffer before the next message reuses it
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -27,7 +28,8 @@ func TestZAPClientListensNowhere(t *testing.T) {
|
||||
names := make(chan string, 2)
|
||||
serve := func(field int) zap.Handler {
|
||||
return func(_ context.Context, _ string, msg *zap.Message) (*zap.Message, error) {
|
||||
names <- msg.Root().Text(field)
|
||||
// Text aliases the receive buffer, which the next message reuses.
|
||||
names <- strings.Clone(msg.Root().Text(field))
|
||||
return statusReply(200)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user