JSON RPC 2.0 Response
Constructor for JSON RPC 2.0 response objects.
Also see related packages json-rpc-request, json-rpc-notification, and json-rpc-error
Installation
npm install json-rpc-response
Usage
id error result;
Response objects can be constructed with or without using the new
keyword.
Arguments error
and result
are mutually exclusive. Argument result
must be
undefined if passing error
. Pass null
as error if result
exists.
Example
var JsonRpcResponse = ; // Result response1 null 'some result'; // Error response1 code: -1 message: 'some error' ;
Test
Run unit tests;
$ npm test