mirror of
https://github.com/sourcegraph/jsonrpc2.git
synced 2026-06-18 13:10:02 +02:00
Always omit params member from request when empty
With this commit, the JSON encoding of `Request` always omits the params
member when calling `Conn.Call`, `Conn.DispatchCall`, or `Conn.Notify`
with the `params` argument set to `nil`. This change also removes the
`OmitNilParams` call option that was added in commit 8012d496 (#62).
As of this commit, if users desire to send a JSON-RPC request with a
`params` value of `null`, then they may do so by explicitly setting the
`params` argument of `Conn.Call`/`Conn.DispatchCall`/`Conn.Notify` to
`json.RawMessage("null")`.
This commit is contained in:
parent
6864d8cc6d
commit
7c2b0a0a06
9 changed files with 142 additions and 147 deletions
|
|
@ -46,12 +46,3 @@ func StringID() CallOption {
|
|||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// OmitNilParams returns a call option that instructs requests to omit params
|
||||
// values of nil instead of JSON encoding them to null.
|
||||
func OmitNilParams() CallOption {
|
||||
return callOptionFunc(func(r *Request) error {
|
||||
r.OmitNilParams = true
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue