creachadair / jrpc2

A Go implementation of a JSON-RPC 2.0 server and client.
BSD 3-Clause "New" or "Revised" License
62 stars 10 forks source link

Rework the jrpc2.ParseRequests function. #81

Closed creachadair closed 2 years ago

creachadair commented 2 years ago

Add a new ParsedRequest type and return that instead of Request. The latter is intended for consumption by Handler methods, and is hard to use effectively in other contexts. The new type exposes validation errors that occur during parsing and allows the caller to detect specific problems with each individual request in a batch separately.

This change also allows us to consolidate the checking of version errors, and to remove most of the special case checks inside the client and server.

Fixes #80.