-
Notifications
You must be signed in to change notification settings - Fork 59
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
Filtering Input Parameters to Childchain/Watcher API depending on HTTP Method #1424
Conversation
…thub.com/omisego/elixir-omg into 1411-filter-params-http-method
Hi all, I just had a chat with @thec00n and there are a few things where we could use more experienced eyes: In
@mederic-p changed to (child chain):
@mederic-p changed to (watcher):
It looks fine in the sense that we want the endpoints to only process valid JSON, but I'm not sure if there's something else to consider here, and why Would appreciate any insights you have there! |
…411-filter-params-http-method
5846ad9
to
8c05f0e
Compare
@unnawut pls review! |
…misego/elixir-omg into 1411-filter-params-http-method
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.
pls remove .tool_versions, distillery, and try if parsers: [:urlencoded, :json],
works only with parsers: [:json],
yep sorry mistake, intended to push only changes to endpoint. |
…411-filter-params-http-method
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.
LGTM
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.
:mindblown: I wouldn't have thought of checking Connection
modules. Thanks you two!
Thanks to @InoMurko for that one! |
Addresses #1411
Overview
This PR implements filtering for input parameters depending on the HTTP method used.
query_params
will be ignored andbody_params
will be used.body_params
will be ignored andquery_params
will be used.Changes
Creates plug in
method_param_filter.ex
files which are added toendpoint.ex
in in bothomg_childchain_rpc
andomg_watcher_rpc
to implement above logic.Testing
method_param_filter.ex
(two files: one for childchain and one for watcher)/account.get_balance
and/transaction.get
) and Child Chain (/block.get
) to test that passing passing query parameters will return a bad request error._For the second set of tests: while these do the job, iI could not think of how to target tests to
endpoint.ex
. Any insights welcome. Note that we have noGET
methods that take input parameters, so no tests written as above.Thanks to @mederic-p who implemented the logic right before his baby was born. I just added a few tests.