-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: make resp result/error conformant to spec #107
Conversation
Co-authored by Ryan <[email protected]>
Yes, it was a regression. I've opened an alternative at #108 which should deal with the original reported problem and let through jsonrpc native errors. |
I think the original regression was noted with the length of time it takes to run tests, so: On #108 so that it actually passes:
And on your branch, with #108 cherry-picked:
That looks pretty consistent to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems OK to me; an alternative, more terse form might be:
func (r response) MarshalJSON() ([]byte, error) {
data := make(map[string]interface{})
data["jsonrpc"] = r.Jsonrpc
data["id"] = r.ID
if r.Error != nil {
data["error"] = r.Error
} else {
data["result"] = r.Result
}
return json.Marshal(data)
}
Co-authored-by: Rod Vagg <[email protected]>
Less explicit, but more readable, I like it. Changed and co-authored you. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and tests appear to be happy with the latest master. Thanks!
Closes #102
This is a more verbose version of #103, mainly because my Go-Fu is too weak to find the issue in that code that causes timeouts. Are there any performance regressions with this? How can I check it?
It works fine on almost latest master, was 5c010e6 a regression @magik6k?