fix: allow deserializing notifications without params field (#729)
This commit is contained in:
parent
1158cfe1b8
commit
fc757d41ca
1 changed files with 25 additions and 3 deletions
|
|
@ -3834,4 +3834,15 @@ mod tests {
|
|||
});
|
||||
assert_eq!(json_url, expected_url_json);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn notification_without_params_should_deserialize_as_bare_jsonrpc_message() {
|
||||
let payload = b"{\"method\":\"notifications/initialized\",\"jsonrpc\":\"2.0\"}";
|
||||
let result: Result<JsonRpcMessage, _> = serde_json::from_slice(payload);
|
||||
assert!(
|
||||
matches!(result, Ok(JsonRpcMessage::Notification(_))),
|
||||
"Expected Ok(Notification), got: {:?}",
|
||||
result
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue