nicolasff / webdis

A Redis HTTP interface with JSON output
https://webd.is
BSD 2-Clause "Simplified" License
2.82k stars 307 forks source link

RAW output format skips null elements in MGET #129

Open janx57 opened 8 years ago

janx57 commented 8 years ago

If we issue an MGET command asking for a key that does not exist we will not get anything for it. For example, let's say that we did the following commands: FLUSHALL SET k1 a SET k2 b

and then we do an MGET command to webdis:

MGET/k1/c/k2.raw

the response is following:

*3 $1 a $1 b

as we see we don't get anything for "c" key which hasn't been set therefore we cannot distinguish which key is missing. According to redis protocol described in:

http://redis.io/topics/protocol

for a null key we should be getting "$-1"

so our output for the previous command should look like:

*3 $1 a $-1 $1 b