1
0
Fork 0
mirror of https://github.com/sourcegraph/jsonrpc2.git synced 2026-06-16 04:04:56 +02:00

Response: Add omitempty tag for Result (#14)

The 'result' key MUST be unset according when the error key is set.
This is not what is happening right now. When the error is set,
"result":null is returned in the response payload. This patch is fixing
the issue by adding omitempty for the result field.
This commit is contained in:
Ondřej Kupka 2017-08-02 20:50:46 +02:00 committed by Keegan Carruthers-Smith
parent b02337b177
commit c6c7b9aa99

View file

@ -128,7 +128,7 @@ func (r *Request) SetMeta(v interface{}) error {
// http://www.jsonrpc.org/specification#response_object.
type Response struct {
ID ID `json:"id"`
Result *json.RawMessage `json:"result"`
Result *json.RawMessage `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
// Meta optionally provides metadata to include in the response.