Skip to content

json: encode nil args as empty params - #105

Open
team-humaki wants to merge 1 commit into
gorilla:mainfrom
team-humaki:json-encode-nil-args
Open

team-humaki wants to merge 1 commit into
gorilla:mainfrom
team-humaki:json-encode-nil-args

Conversation

@team-humaki

Copy link
Copy Markdown

EncodeClientRequest always wrapped args in a one-element array, so a nil args value became [null]. Methods with no parameters then had no way to send a well-formed request.

JSON-RPC 1.0 (json and v2/json) now encodes nil args as []. JSON-RPC 2.0 (v2/json2) omits params when args is nil. Non-nil args are unchanged.

Fixes #54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

json.EncodeClientRequest for a method that has no arguments

1 participant