File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
tests/StackExchange.Redis.Tests/ResultProcessorUnitTests Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -292,7 +292,7 @@ private sealed class ClientInfoProcessor : ResultProcessor<ClientInfo[]>
292292 {
293293 protected override bool SetResultCore ( PhysicalConnection connection , Message message , ref RespReader reader )
294294 {
295- if ( reader . IsScalar )
295+ if ( reader . Prefix is RespPrefix . BulkString or RespPrefix . VerbatimString )
296296 {
297297 var raw = reader . ReadString ( ) ;
298298 if ( TryParse ( raw , out var clients ) )
Original file line number Diff line number Diff line change @@ -69,4 +69,25 @@ public void NotBulkString_Failure()
6969
7070 ExecuteUnexpected ( resp , StackExchange . Redis . ClientInfo . Processor ) ;
7171 }
72+
73+ [ Fact ]
74+ public void VerbatimString_Success ( )
75+ {
76+ // Verbatim string with TXT encoding - should behave identically to bulk string
77+ // Format: ={len}\r\n{enc}:{payload}\r\n where enc is exactly 3 bytes (e.g., "TXT")
78+ var content = "id=86 addr=172.17.0.1:40750 laddr=172.17.0.2:3000 fd=22 name= age=7 idle=0 flags=N db=0 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=26 qbuf-free=20448 argv-mem=10 multi-mem=0 rbs=1024 rbp=0 obl=0 oll=0 omem=0 tot-mem=22810 events=r cmd=client|list user=default redir=-1 resp=2 lib-name= lib-ver= io-thread=0 tot-net-in=48 tot-net-out=36 tot-cmds=0\n " ;
79+ var totalLen = 4 + content . Length ; // "TXT:" + content
80+ var resp = $ "={ totalLen } \r \n TXT:{ content } \r \n ";
81+
82+ var result = Execute ( resp , StackExchange . Redis . ClientInfo . Processor ) ;
83+
84+ // ReadString() automatically strips the "TXT:" encoding prefix,
85+ // so the result should be identical to the bulk string test
86+ Assert . NotNull ( result ) ;
87+ Assert . Single ( result ) ;
88+ Assert . Equal ( 86 , result [ 0 ] . Id ) ;
89+ Assert . Equal ( "172.17.0.1:40750" , result [ 0 ] . Address ? . ToString ( ) ) ;
90+ Assert . Equal ( 7 , result [ 0 ] . AgeSeconds ) ;
91+ Assert . Equal ( 0 , result [ 0 ] . Database ) ;
92+ }
7293}
You can’t perform that action at this time.
0 commit comments