28 Commits

Author SHA1 Message Date
Zahary Karadjov
7ff4559cc0 Allow dynamic RPC method names in the 'rpc' macro 2021-11-24 15:57:46 +02:00
Zahary Karadjov
2307dbec57 Add support for producing custom error codes from request hanlers 2021-10-06 10:50:08 +02:00
KonradStaniec
147ef3f562
[FEATURE] Add http json rpc proxy (#105) 2021-06-29 18:13:31 +03:00
Jacek Sieka
64d40d6c1a
simplify imports (#98)
remove broken uint64 converter - upstream std/json also includes a
broken uint64 converter
2021-03-26 13:17:00 +01:00
Jacek Sieka
ac5288651c
Exception handling signatures (#97)
Minimally work around leaking `Exception` for
https://github.com/status-im/nim-chronos/pull/166
2021-03-26 11:53:03 +01:00
Jacek Sieka
4eb39203eb
fixes (#95)
* fixes

* fix https://github.com/status-im/nimbus-eth2/issues/1650
* only one of `result` and `error` allowed in response
* fix invalid `string` instances being created from byte sequences
* fix large int64 parsing on 32-bit
* fix exception inheritance
* fix some dangling results
* some cleanups

* annotate exception issues, fix cancellation

* more error handling cleanup

* add rudimentary error tests

* cleanups

* simplify init
* use nextId -> lastId to avoid =1 init
* remove obsolete tests
2021-02-15 13:45:51 +01:00
Joe Clapis
831471f6d4
Added the ability to handle omitted params fields in incoming requests, and a unit test for it (#94) 2021-02-07 20:27:34 +01:00
Zahary Karadjov
6fbaeb61ca
Switch to json_serialition.JsonString to facilitate Chronicles logging 2020-03-18 18:14:29 +02:00
Zahary Karadjov
f53e0b960b
Fix all tests 2020-03-17 22:05:42 +02:00
Zahary Karadjov
d19de19128
Refactor the router to allow bypassing the use of std/json
The users will be now able to write RPC handlers returning the
distinct type `StringOfJson`. This will bypass any use of the
standard library's JsonNode type and its serialization routines.

The change was motivated by the integration of JSON-RPC in
status-im/nim-beacon-chain where most of the data types cannot
be handled by Nim's std lib or json-rpc's jsonmarshal module.
2020-03-17 20:38:52 +02:00
Zahary Karadjov
4d1d2577e9
Trivial changes required for the beacon node integration 2020-03-17 00:17:10 +02:00
Zahary Karadjov
9b401994a1
Follow the convention of naming types as UpperCase 2020-01-21 18:50:50 +02:00
Zahary Karadjov
6f9da4ba8a
Make the RPC procs async again 2020-01-21 18:49:52 +02:00
Ștefan Talpalaru
72a99cc977
replace getCurrentExceptionMsg() and delete some unused imports 2019-12-02 12:26:09 +01:00
kdeme
707567c7ab Check if method field is a string 2019-05-17 11:58:51 +03:00
kdeme
40411aef5a Add JObject check to resolve possible unhandled exception 2019-04-29 22:04:56 +03:00
Mamy Ratsimbazafy
53ed44dfa5
Rebrand asyncdispatch2 to chronos (#50) 2019-02-06 18:27:58 +01:00
Ștefan Talpalaru
64a9999ac9 another {.gcsafe.} pragma, just for Windows 2019-01-17 18:35:15 +02:00
Zahary Karadjov
26953344c3 Turn some potentially dangerous templates into functions
Be careful when creating templates. If the input parameters are
referenced within the body multiple times, this may lead to multiple
evaluations of functions with side-effects.
2018-11-12 23:51:24 +02:00
Zahary Karadjov
642fdd591f fix the package structure to make Nimble happy 2018-07-20 19:34:10 +03:00
coffeepots
3da2738e27 Fix gcsafe error in debug, use getOrDefault instead of {} 2018-07-12 09:23:38 +01:00
coffeepots
49085bbd28 Simplify error trapping 2018-07-11 21:49:08 +01:00
coffeepots
f09aeffd65 Fix incompatibility between returning JSON errors and fixed types 2018-07-11 19:16:11 +01:00
coffeepots
3b8e736f35 Wrap RPC exceptions in JSON 2018-07-11 18:27:50 +01:00
coffeepots
ceec0e7690 Renamed ifRoute to tryRoute 2018-07-10 16:51:26 +01:00
coffeepots
eb23c46949 Split route into json only and string version, fix lack of terminator 2018-07-10 16:07:47 +01:00
coffeepots
f60a648968 Move remaining rpc routing to router.nim 2018-07-10 10:39:09 +01:00
coffeepots
cf44cc552d Remove DSL, add router and simplify server 2018-07-06 17:47:43 +01:00