-
Notifications
You must be signed in to change notification settings - Fork 188
Add GET & OPTIONS request functionality to JSON-RPC servers #712
Conversation
Merge CoZ Development into jseagrave21 Development
Merge CoZ Development into jseagrave21 Development
Merge CoZ Development into jseagrave21 Development
* Update ExtendedJsonRpcApi.py - add fix provided by @localhuman so original methods are returned as well as extended methods
…yOfZion#661) * Add the option -u (unittest-net) to prompt.py * Add unittest guildeline and add the smart contract source codes (UnitTest-SM.zip) to the fixtures package
for compatibility
* Fix ExtendedJsonRpcApi (CityOfZion#662) * Update ExtendedJsonRpcApi.py - add fix provided by @localhuman so original methods are returned as well as extended methods * Mute expected test stacktrace and clearly identify why an exception is thrown. (CityOfZion#663) * Add guideline for adding tests to the neo-privnet-unittest image (CityOfZion#661) * Add the option -u (unittest-net) to prompt.py * Add unittest guildeline and add the smart contract source codes (UnitTest-SM.zip) to the fixtures package * Add raw transaction building examples (CityOfZion#665) * Update neo-boa version to fix core building test
Merge CoZ Development into jseagrave21 Development
Merge CoZ Development into jseagrave21 Development
Merge CoZ Development into jseagrave21 Development
Merge CoZ Development into jseagrave21 development
Merge CoZ development into jseagrave21 development
- add tests for "showallaccounts" and "showallaccountstates"
Merge neo-python development into jseagrave21 development
- add furl
- add support for GET Requests
- update tests to include GET requests
- update tests for GET requests
- update tests for GET requests
- add a test for a GET request with bad "params" field
Where does this limitation come from? Is that implementation based or also described in the JSON-RPC specifications?
Same question as above |
@ixje The first limitation occurs because of how The second limitation occurs also because of how Both of these limitations are mentioned here: /~https://github.com/CityOfZion/neo-python/pull/712/files#diff-f9e9d3e0fbf0fb287940a8d009a379b2R132 |
@ixje @localhuman One of the new features of this implementation is the sorting of URI methods. After watching my RPC server for a bit I noticed that other than "POST" methods, I also see "OPTIONS" method requests:
Originally, I filtered out all other request methods other than "POST" or "GET". Do I need to add some kind of functionality if an "OPTIONS" method request is made, or a different method? (reference https://www.tutorialspoint.com/http/http_methods.htm) -update- I just tried an "OPTIONS" request and received:
I think it would be nice to add a message indicating that "GET" and "POST" methods are accepted. |
But this
get's an additional I don't know about OPTIONS. The basic validation rule to check against is; |
@ixje I solved the params problem. Also, neo-cli does not support multiple requests in a GET request, so I am not going to try to add support for it. For example:
|
- add functionality for having params field as last field - add a response for an HTTP OPTIONS request to identify the supported HTTP methods
- add test for HTTP OPTIONS request - show support for having params as last field
for compatibility
Merge neo-python development into jseagrave21 development
I had a thought that it would be nice to identify the JSON-RPC server type with an OPTIONS request. So, an OPTIONS request will yield:
for default RPC servers and
for Extended-RPC servers |
- add server-type identifier for OPTIONS request
- update OPTIONS test for server-type
- add server-type for OPTIONS request
- add specific test for OPTIONS request
- add a functional return for an unsupported HTTP method
- update test_invalid_request_method for functional return
- update test for unsupported HTTP method for an extended-rpc server
- update test for invalid HTTP request
for compatibility
for compatibility
Merge neo-python development into jseagrave21 GET-Requests
all looks good, thanks! 💪 |
Add GET & OPTIONS request functionality to JSON-RPC servers (CityOfZion#712)
- update documentation for CityOfZion#712 and CityOfZion#719
What current issue(s) does this address, or what feature is it adding?
@xxedocxx (@ed#2854 on Discord) brought up the issue that GET requests do not work and he DM'ed me saying he would like to see this functionality added. I have also noticed this and desired the same, so I could query RPC nodes from my phone's web browser.
@xxedocxx contributed the initial ability to parse GET request URI's into dictionary format using
furl
. It was great teamwork!NOTE: this implementation requires that the "params" field not be last in GET requests (or there are parse errors)
-edit-
NOTE: also, GET requests do not support multiple requests in 1 transaction (tested; maintains parody with neo-cli)
How did you solve this problem?
trial, error, and teamwork
How did you make sure your solution works?
lots of personal testing and unittest
Are there any special changes in the code that we should be aware of?
Adds
furl
to requirements.txPlease check the following, if applicable:
make lint
?make test
?CHANGELOG.rst
? (if not, please do)