@@ -161,8 +161,10 @@ def test_batch_requests(self):
161
161
self .log .info ("Testing nonstandard jsonrpc 1.0 version number is accepted..." )
162
162
self .test_batch_request (lambda idx : BatchOptions (request_fields = {"jsonrpc" : "1.0" }))
163
163
164
- self .log .info ("Testing unrecognized jsonrpc version number is accepted..." )
165
- self .test_batch_request (lambda idx : BatchOptions (request_fields = {"jsonrpc" : "2.1" }))
164
+ self .log .info ("Testing unrecognized jsonrpc version number is rejected..." )
165
+ self .test_batch_request (lambda idx : BatchOptions (
166
+ request_fields = {"jsonrpc" : "2.1" },
167
+ response_fields = {"result" : None , "error" : {"code" : RPC_INVALID_REQUEST , "message" : "JSON-RPC version not supported" }}))
166
168
167
169
def test_http_status_codes (self ):
168
170
self .log .info ("Testing HTTP status codes for JSON-RPC 1.1 requests..." )
@@ -188,11 +190,11 @@ def test_http_status_codes(self):
188
190
expect_http_rpc_status (500 , RPC_INVALID_PARAMETER , self .nodes [0 ], "getblockhash" , [42 ], 2 , False )
189
191
# force-send invalidly formatted requests
190
192
response , status = send_json_rpc (self .nodes [0 ], {"jsonrpc" : 2 , "method" : "getblockcount" })
191
- assert_equal (response , {"error " : None , "id " : None , "result " : 0 })
192
- assert_equal (status , 200 )
193
+ assert_equal (response , {"id " : None , "result " : None , "error " : { "code" : RPC_INVALID_REQUEST , "message" : "jsonrpc field must be a string" } })
194
+ assert_equal (status , 400 )
193
195
response , status = send_json_rpc (self .nodes [0 ], {"jsonrpc" : "3.0" , "method" : "getblockcount" })
194
- assert_equal (response , {"error " : None , "id " : None , "result " : 0 })
195
- assert_equal (status , 200 )
196
+ assert_equal (response , {"id " : None , "result " : None , "error " : { "code" : RPC_INVALID_REQUEST , "message" : "JSON-RPC version not supported" } })
197
+ assert_equal (status , 400 )
196
198
197
199
self .log .info ("Testing HTTP status codes for JSON-RPC 2.0 notifications..." )
198
200
# Not notification: id exists
0 commit comments