Skip to content

Commit 4946ec5

Browse files
committed
fixup! feat(jsonrpc): add support for JSON-RPC 2.0 batch requests
1 parent b6c293c commit 4946ec5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

internal/jsonrpc/jsonrpc.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ func (s *Service) handleRequest(w io.Writer, r *http.Request, req RPCRequest) er
242242

243243
var rpcErr *RPCError
244244
if errors.As(err, &rpcErr) {
245+
// RPC errors describe expected client-facing failures. Do not log them at
246+
// error level; unexpected failures are logged below before being hidden.
245247
return writeRPCError(w, req.ID, rpcErr.Code, rpcErr.Message)
246248
}
247249

@@ -344,8 +346,8 @@ func (s *Service) handleRPC(w http.ResponseWriter, r *http.Request) {
344346
s.dispatchOneRequest(w, r, req, budgetResp)
345347

346348
case '[':
347-
// Keep each batch element raw so malformed requests can fail independently
348-
// without preventing valid requests in the same batch from being handled.
349+
// Keep each batch element raw so malformed requests fail independently and
350+
// the list-item limit can be checked before dispatching any request.
349351
var reqSeq []json.RawMessage
350352
if err := json.Unmarshal(body, &reqSeq); err != nil {
351353
s.writeRPCError(w, nil, JSONRPC_PARSE_ERROR, "invalid request batch")

0 commit comments

Comments
 (0)