Don’t throw an RPC Error when no params key is specified

This commit is contained in:
Tobie Morgan Hitchcock 2022-10-19 18:57:03 +01:00
parent 7f84504170
commit 1becd3ab55

View file

@ -16,6 +16,7 @@ use std::collections::BTreeMap;
use std::sync::Arc; use std::sync::Arc;
use surrealdb::channel; use surrealdb::channel;
use surrealdb::channel::Sender; use surrealdb::channel::Sender;
use surrealdb::sql::Array;
use surrealdb::sql::Object; use surrealdb::sql::Object;
use surrealdb::sql::Strand; use surrealdb::sql::Strand;
use surrealdb::sql::Value; use surrealdb::sql::Value;
@ -145,7 +146,7 @@ impl Rpc {
// Fetch the 'params' argument // Fetch the 'params' argument
let params = match req.pick(&*PARAMS) { let params = match req.pick(&*PARAMS) {
Value::Array(v) => v, Value::Array(v) => v,
_ => return Response::failure(id, Failure::INVALID_REQUEST).send(chn).await, _ => Array::new(),
}; };
// Match the method to a function // Match the method to a function
let res = match &method[..] { let res = match &method[..] {