Skip to content

json2: keep object unmarshal error for by-name params - #103

Open
team-humaki wants to merge 1 commit into
gorilla:mainfrom
team-humaki:json2-object-params-error
Open

team-humaki wants to merge 1 commit into
gorilla:mainfrom
team-humaki:json2-object-params-error

Conversation

@team-humaki

Copy link
Copy Markdown

Fixes #70

JSON-RPC 2.0 params is either an object (by-name) or an array (by-position). ReadRequest currently treats any unmarshal failure as "not an object" and retries as a 1-element array, so a custom-type error inside an object is replaced by a misleading array-shape error.

If the first non-space byte of params is {, return the original unmarshal error as E_INVALID_REQ. Array params still use the existing fallback.

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 unmarshal of payload does not support custom type errors

1 participant