ewwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
@ -101,6 +101,9 @@ func readBulkString(prefix []byte, r io.Reader) (value, error) {
return nil, fmt.Errorf("unable to read bulkstring in redis protocol: bad prefix: %v", err)
}
if n == -1 {
return nil, nil
n += 2
b := make([]byte, n)
n_read, err := r.Read(b)
@ -47,6 +47,7 @@ var valueTests = []valueTest{
{"-one two ", Error("one two ")}, // trailing space
{"- one two", Error(" one two")}, // leading space
{"$-1\r\n", nil},
{"$0\r\n\r\n", BulkString("")}, // is this even a thing?
{"$1\r\nx\r\n", BulkString("x")},
{"$4\r\netsy\r\n", BulkString("etsy")},