Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue/Task Number: -
Overview
This PR fixes the error when Potterhat receives a JSON-RPC batch request.
This bug was found while integrating Potterhat with omisego/ewallet's
eth-blockchain
branch.Changes
PotterhatRPC.Router
Implementation Details
When Phoenix receives a JSON array as body params, it wraps those params in a
%{"_json" => _}
map before passing it to the router. So an extra condition is added to support this quirk.Usage
Try send a batch request to Potterhat. E.g.
A successful response should be returned instead of an internal server error.
Impact
No changes to API or DB.