@@ -20,29 +20,29 @@ type EndpointCodec struct {
2020// EndpointCodecMap maps the Request.Method to the proper EndpointCodec
2121type EndpointCodecMap map [string ]EndpointCodec
2222
23- // DecodeRequestFunc extracts a user-domain request object from an raw JSON
24- // It's designed to be used in HTTP servers, for server-side endpoints.
23+ // DecodeRequestFunc extracts a user-domain request object from raw JSON
24+ // It's designed to be used in JSON RPC servers, for server-side endpoints.
2525// One straightforward DecodeRequestFunc could be something that unmarshals
2626// JSON from the request body to the concrete request type.
2727type DecodeRequestFunc func (context.Context , json.RawMessage ) (request interface {}, err error )
2828
29- // EncodeResponseFunc encodes the passed response object to a JSON RPC response .
29+ // EncodeResponseFunc encodes the passed response object to a JSON RPC result .
3030// It's designed to be used in HTTP servers, for server-side endpoints.
3131// One straightforward EncodeResponseFunc could be something that JSON encodes
3232// the object directly.
3333type EncodeResponseFunc func (context.Context , interface {}) (response json.RawMessage , err error )
3434
3535// Client-Side Codec
3636
37- // EncodeRequestFunc encodes the passed request object to raw JSON.
37+ // EncodeRequestFunc encodes the given request object to raw JSON.
3838// It's designed to be used in JSON RPC clients, for client-side
3939// endpoints. One straightforward EncodeResponseFunc could be something that
4040// JSON encodes the object directly.
4141type EncodeRequestFunc func (context.Context , interface {}) (request json.RawMessage , err error )
4242
43- // DecodeResponseFunc extracts a user-domain response object from an HTTP
44- // request object. It's designed to be used in JSON RPC clients, for
45- // client-side endpoints. One straightforward DecodeRequestFunc could be
46- // something that JSON decodes from the request body to the concrete
47- // response type .
48- type DecodeResponseFunc func (context.Context , json. RawMessage ) (response interface {}, err error )
43+ // DecodeResponseFunc extracts a user-domain response object from an JSON RPC
44+ // response object. It's designed to be used in JSON RPC clients, for
45+ // client-side endpoints. It is the responsibility of this function to decide
46+ // whether any error present in the JSON RPC response should be surfaced to the
47+ // client endpoint .
48+ type DecodeResponseFunc func (context.Context , Response ) (response interface {}, err error )
0 commit comments