Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent request being serialized twice #11

Closed

Commits on Feb 11, 2019

  1. fix: prevent request being serialized twice

    json-ipc-lib will make use of json-rpc-protocol module.
    In its current form it already does a JSON.stringify inside the submodule.
    Client.js tries this a second time, which will result in
    a compliant server not understand the request.
    
    { Error: JSON-IPC Client Exception::Expected {} for json command
        at Socket.<anonymous> (./node_modules/json-ipc-lib/dist/Client.js:171:36)
        at Socket.emit (events.js:197:13)
    
    Note:
    This will not happen for 'method only' calls but for
    'object' {method, params, ...} calls.
    
    Relevant code snippets:
    
    Client.js
    ```JS
    import * as protocol from 'json-rpc-protocol';
    // ...
    protocol.format.request(
    	Date.now(),
    	method,
    	args);
    ...
    socket.write(JSON.strinify(request));
    ```
    
    node_modules/json-rpc-protocol/dist/format.js
    ```JS
    var toJson = JSON.stringify;
    ...
      return toJson({
        jsonrpc: '2.0',
        id,
        error: _error
      });
    ```
    m-schmoock committed Feb 11, 2019
    Configuration menu
    Copy the full SHA
    4508027 View commit details
    Browse the repository at this point in the history