package tezt-tezos

  1. Overview
  2. Docs
type uri_provider
val call : ?rpc_hooks:rpc_hooks -> ?log_request:bool -> ?log_response_status:bool -> ?log_response_body:bool -> uri_provider -> 'result 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_hooks -> ?log_request:bool -> ?log_response_status:bool -> ?log_response_body:bool -> uri_provider -> 'result t -> string 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_hooks -> ?log_request:bool -> ?log_response_status:bool -> ?log_response_body:bool -> uri_provider -> 'result t -> Tezt_wrapper.JSON.t 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.

OCaml

Innovation. Community. Security.