Elaborate comment on jsonPatchingCodec.

This commit is contained in:
Jonathan Moody 2022-10-28 09:31:10 -04:00
parent a3bedc2c1d
commit 18fa12a6bd

View file

@ -426,8 +426,11 @@ type serverResponse struct {
} }
// jsonPatchingCodec is able to intercept the JSON requests/responses // jsonPatchingCodec is able to intercept the JSON requests/responses
// and tweak them. Currently it appears we need to add a // and tweak them. Currently, it appears we need to make several changes:
// "jsonrpc": "1.0" or "jsonrpc": "2.0" to make the client happy. // 1) add "jsonrpc": "2.0" (or "jsonrpc": "1.0") in response
// 2) add newline to frame response
// 3) add "params": [] when "params" is missing
// 4) replace params ["arg1", "arg2", ...] with [["arg1", "arg2", ...]]
type jsonPatchingCodec struct { type jsonPatchingCodec struct {
conn net.Conn conn net.Conn
inBuffer *bytes.Buffer inBuffer *bytes.Buffer