mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 01:41:37 +03:00
25a55c0f63
Moves them into files in /lib, and updates dependents accordingly.
32 lines
590 B
Plaintext
32 lines
590 B
Plaintext
:: json-rpc: protocol utilities
|
|
::
|
|
/- *json-rpc
|
|
|%
|
|
++ request-to-hiss
|
|
|= [url=purl:eyre req=request]
|
|
^- hiss:eyre
|
|
:- url
|
|
:+ %post
|
|
%- ~(gas in *math:eyre)
|
|
~['Content-Type'^['application/json']~]
|
|
%- some
|
|
%- as-octt:mimes:html
|
|
(en-json:html (request-to-json req))
|
|
::
|
|
++ request-to-json
|
|
|= request
|
|
^- json
|
|
%- pairs:enjs:format
|
|
:~ jsonrpc+s+'0.2'
|
|
id+s+id
|
|
method+s+method
|
|
::
|
|
:- %params
|
|
^- json
|
|
?- -.params
|
|
%list [%a +.params]
|
|
%object [%o (~(gas by *(map @t json)) +.params)]
|
|
==
|
|
==
|
|
--
|