Allow NULL and missing values in RPC query method

This commit is contained in:
Tobie Morgan Hitchcock 2022-07-08 21:56:04 +01:00
parent 11a3911f70
commit d425f67a8b

View file

@ -148,7 +148,7 @@ impl Rpc {
_ => return Response::failure(id, Failure::INVALID_PARAMS).send(chn).await, _ => return Response::failure(id, Failure::INVALID_PARAMS).send(chn).await,
}, },
"query" => match params.take_two() { "query" => match params.take_two() {
(Value::Strand(s), Value::None) => rpc.read().await.query(s).await, (Value::Strand(s), o) if o.is_none() => rpc.read().await.query(s).await,
(Value::Strand(s), Value::Object(o)) => rpc.read().await.query_with(s, o).await, (Value::Strand(s), Value::Object(o)) => rpc.read().await.query_with(s, o).await,
_ => return Response::failure(id, Failure::INVALID_PARAMS).send(chn).await, _ => return Response::failure(id, Failure::INVALID_PARAMS).send(chn).await,
}, },