You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I use this lib to make a call to aria2c system.listMethods, I find the params serialized to null even when the method defined without args.
use jsonrpc_core_client::transports::http;use jsonrpc_core::Result;use jsonrpc_derive::rpc;/// Rpc trait#[rpc]pubtraitRpc{/// Returns a protocol version#[rpc(name = "system.listMethods")]fnlist_methods(&self) -> Result<Vec<String>>;}#[tokio::main]asyncfnmain() -> Result<()>{let client = http::connect::<gen_client::Client>("http://127.0.0.1:6800/jsonrpc").await.unwrap();println!("{:?}", client.list_methods().await.unwrap());Ok(())}
the code will send {"jsonrpc":"2.0","method":"system.listMethods","params":null,"id":0} to aria2 and then got HTTPError: HTTP Error 500: Internal Server Error
if skip the params when it is None, things go right.
/// Represents jsonrpc request which is a method call.#[derive(Clone,Debug,PartialEq,Deserialize,Serialize)]#[serde(deny_unknown_fields)]pubstructMethodCall{/// A String specifying the version of the JSON-RPC protocol.pubjsonrpc:Option<Version>,/// A String containing the name of the method to be invoked.pubmethod:String,/// A Structured value that holds the parameter values to be used/// during the invocation of the method. This member MAY be omitted.#[serde(default = "default_params")]#[serde(skip_serializing_if="omit_params")]pubparams:Params,/// An identifier established by the Client that MUST contain a String,/// Number, or NULL value if included. If it is not included it is assumed/// to be a notification.pubid:Id,}fnomit_params(param:&Params) -> bool{&Params::None == param
}
so could we add this annotation to skip serializing when it is None?
The text was updated successfully, but these errors were encountered:
when I use this lib to make a call to aria2c system.listMethods, I find the
params
serialized tonull
even when the method defined without args.the code will send
{"jsonrpc":"2.0","method":"system.listMethods","params":null,"id":0}
to aria2 and then gotHTTPError: HTTP Error 500: Internal Server Error
if skip the
params
when it isNone
, things go right.so could we add this annotation to skip serializing when it is
None
?The text was updated successfully, but these errors were encountered: