Skip to content

Commit f113d54

Browse files
committed
fix(resp): correct CLIENT REPLY SKIP typo in command kind detection
s/SKIPP/SKIP in the byte pattern matching of `CommandKind::from`. The extra 'P' prevented `CLIENT REPLY SKIP` from being recognized, so `is_reply_on` was never set to false and the handler incorrectly expected responses for skipped commands.
1 parent fb32efb commit f113d54

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/resp/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<'a> From<&'a Command> for CommandKind {
128128
b"CLIENT" => match (command.get_arg(0).as_deref(), command.get_arg(1).as_deref()) {
129129
(Some(b"REPLY"), Some(b"ON")) => CommandKind::ClientReply(ClientReplyMode::On),
130130
(Some(b"REPLY"), Some(b"OFF")) => CommandKind::ClientReply(ClientReplyMode::Off),
131-
(Some(b"REPLY"), Some(b"SKIPP")) => CommandKind::ClientReply(ClientReplyMode::Skip),
131+
(Some(b"REPLY"), Some(b"SKIP")) => CommandKind::ClientReply(ClientReplyMode::Skip),
132132
_ => CommandKind::Other,
133133
},
134134
b"RESET" => CommandKind::Reset,

src/tests/connection_commands.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,22 @@ async fn client_reply() -> Result<()> {
201201
Ok(())
202202
}
203203

204+
#[cfg_attr(feature = "tokio-runtime", tokio::test)]
205+
#[cfg_attr(feature = "async-std-runtime", async_std::test)]
206+
#[serial]
207+
async fn client_reply_skip() -> Result<()> {
208+
let client = get_test_client().await?;
209+
client.flushdb(FlushingMode::Sync).await?;
210+
211+
client.client_reply(ClientReplyMode::Skip).forget()?;
212+
client.set("skip_key", "skip_value").forget()?;
213+
client.client_reply(ClientReplyMode::On).await?;
214+
let value: String = client.get("skip_key").await?;
215+
assert_eq!("skip_value", value);
216+
217+
Ok(())
218+
}
219+
204220
#[cfg_attr(feature = "tokio-runtime", tokio::test)]
205221
#[cfg_attr(feature = "async-std-runtime", async_std::test)]
206222
#[serial]

0 commit comments

Comments
 (0)