Closed mic1983 closed 6 years ago
Hi there. Thanks for pointing this out.
Here's the bit of code you are referencing:
public function notification($method, array $params = null)
{
return $this->createRequest(RequestInterface::NOTIFICATION, array_filter([
'jsonrpc' => self::SPEC,
'method' => $method,
'params' => $params,
]));
}
Having looked at the spec again, I think this behaviour is correct with regards to the params
field. Here are the two bits that I think support this:
params A Structured value that holds the parameter values to be used during the invocation of the method. This member MAY be omitted.
4.2 Parameter Structures If present, parameters for the rpc call MUST be provided as a Structured value. Either by-position through an Array or by-name through an Object.
- by-position: params MUST be an Array, containing the values in the Server expected order.
- by-name: params MUST be an Object, with member names that match the Server expected parameter names. The absence of expected names MAY result in an error being generated. The names MUST match exactly, including case, to the method's expected parameters.
So params
MUST contains some properties either in an array or an object. An empty array or a null would violate this and therefore it is removed and this is fine because it MAY be omitted.
This make json rpc request Invalid
Is there a specific error message you have received from somewhere or is this a general observation?
This make json rpc request Invalid