Fix Bug #33814: handleBatch only accounted for len(resp.Result) when
accumulating responseBytes for maxResponseSize. Error responses have
resp.Result == nil, so large error payloads (via rpc.DataError) were
not counted toward the batch response size limit.
Changes:
- rpc/json.go: add size() method to jsonrpcMessage that returns
len(Result) for success responses, or the serialized size of the
full error response (including Error.Data) for error responses
- rpc/handler.go: use resp.size() instead of len(resp.Result) in
handleBatch to count all response types toward maxResponseSize
- rpc/server_test.go: add TestServerBatchResponseSizeLimitError to
verify error responses with large data are correctly counted
- rpc/testservice_test.go: add largeDataError type and
ReturnLargeError method to generate error responses with data
exceeding the batch response size limit