Allow empty params object from text-based WebSocket clients
Closes #1610
This commit is contained in:
parent
6785c65b60
commit
9282feac1f
2 changed files with 5 additions and 1 deletions
|
@ -601,6 +601,10 @@ impl Value {
|
|||
// Simple value detection
|
||||
// -----------------------------------
|
||||
|
||||
pub fn is_none_or_null(&self) -> bool {
|
||||
matches!(self, Value::None | Value::Null)
|
||||
}
|
||||
|
||||
pub fn is_none(&self) -> bool {
|
||||
matches!(self, Value::None)
|
||||
}
|
||||
|
|
|
@ -290,7 +290,7 @@ impl Rpc {
|
|||
},
|
||||
// Run a full SurrealQL query against the database
|
||||
"query" => match params.needs_one_or_two() {
|
||||
Ok((Value::Strand(s), o)) if o.is_none() => {
|
||||
Ok((Value::Strand(s), o)) if o.is_none_or_null() => {
|
||||
return match rpc.read().await.query(s).await {
|
||||
Ok(v) => res::success(id, v).send(out, chn).await,
|
||||
Err(e) => {
|
||||
|
|
Loading…
Reference in a new issue