mirror of
https://github.com/sourcegraph/jsonrpc2.git
synced 2026-07-04 00:03:41 +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:
parent
b02337b177
commit
c6c7b9aa99
1 changed files with 1 additions and 1 deletions
|
|
@ -128,7 +128,7 @@ func (r *Request) SetMeta(v interface{}) error {
|
||||||
// http://www.jsonrpc.org/specification#response_object.
|
// http://www.jsonrpc.org/specification#response_object.
|
||||||
type Response struct {
|
type Response struct {
|
||||||
ID ID `json:"id"`
|
ID ID `json:"id"`
|
||||||
Result *json.RawMessage `json:"result"`
|
Result *json.RawMessage `json:"result,omitempty"`
|
||||||
Error *Error `json:"error,omitempty"`
|
Error *Error `json:"error,omitempty"`
|
||||||
|
|
||||||
// Meta optionally provides metadata to include in the response.
|
// Meta optionally provides metadata to include in the response.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue