package tezt-tezos
val call :
?rpc_hooks:RPC_core.rpc_hooks ->
?log_request:bool ->
?log_response_status:bool ->
?log_response_body:bool ->
remote_uri_provider ->
'result RPC_core.t ->
'result Lwt.t
Call an RPC.
The response body is parsed as JSON, then decoded using the decode function of the RPC description.
Calls Test.fail
if the status code is not a success code. To handle error cases, use call_raw
or call_json
instead. They return the status code and you can use decode
to parse the response body in case of success.
Parameter hooks
allows to attach some hooks to the RPC.
If log_request
is true
, log the HTTP method and URI before calling the RPC. Default is true
.
If log_response_status
is true
, log the HTTP status code of the response after the RPC call. Default is true
.
If log_response_body
is true
, log the response body after the RPC call.
For call
and call_json
, if the response is valid JSON, it is pretty-printed with indentation. Default is true
.
val call_raw :
?rpc_hooks:RPC_core.rpc_hooks ->
?log_request:bool ->
?log_response_status:bool ->
?log_response_body:bool ->
remote_uri_provider ->
'result RPC_core.t ->
string RPC_core.response Lwt.t
Call an RPC, but do not parse its response body.
Does not fail if the status code is not a success code.
val call_json :
?rpc_hooks:RPC_core.rpc_hooks ->
?log_request:bool ->
?log_response_status:bool ->
?log_response_body:bool ->
remote_uri_provider ->
'result RPC_core.t ->
Tezt_wrapper.JSON.t RPC_core.response Lwt.t
Call an RPC, but do not decode its response body, only parse as JSON.
Does not fail if the status code is not a success code, except if the response body is not valid JSON.