github.com/aigarnetwork/aigar@v0.0.0-20191115204914-d59a6eb70f8e/rpc/testdata/invalid-batch.js (about)

     1  /*
     2   * // Copyright 2018 The go-ethereum Authors
     3   * // Copyright 2019 The go-aigar Authors
     4   * // This file is part of the go-aigar library.
     5   * //
     6   * // The go-aigar library is free software: you can redistribute it and/or modify
     7   * // it under the terms of the GNU Lesser General Public License as published by
     8   * // the Free Software Foundation, either version 3 of the License, or
     9   * // (at your option) any later version.
    10   * //
    11   * // The go-aigar library is distributed in the hope that it will be useful,
    12   * // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13   * // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    14   * // GNU Lesser General Public License for more details.
    15   * //
    16   * // You should have received a copy of the GNU Lesser General Public License
    17   * // along with the go-aigar library. If not, see <http://www.gnu.org/licenses/>.
    18   */
    19  
    20  // This test checks the behavior of batches with invalid elements.
    21  // Empty batches are not allowed. Batches may contain junk.
    22  
    23  --> []
    24  <-- {"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"empty batch"}}
    25  
    26  --> [1]
    27  <-- [{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"invalid request"}}]
    28  
    29  --> [1,2,3]
    30  <-- [{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"invalid request"}},{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"invalid request"}},{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"invalid request"}}]
    31  
    32  --> [{"jsonrpc":"2.0","id":1,"method":"test_echo","params":["foo",1]},55,{"jsonrpc":"2.0","id":2,"method":"unknown_method"},{"foo":"bar"}]
    33  <-- [{"jsonrpc":"2.0","id":1,"result":{"String":"foo","Int":1,"Args":null}},{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"invalid request"}},{"jsonrpc":"2.0","id":2,"error":{"code":-32601,"message":"the method unknown_method does not exist/is not available"}},{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"invalid request"}}]