Module Injector.RPC

type status =
  1. | Pending
  2. | Injected of {
    1. injected_oph : string;
    2. injected_op_index : int;
    }
  3. | Included of {
    1. included_oph : string;
    2. included_op_index : int;
    3. block : string;
    4. level : int;
    }
val add_pending_transaction : ?parameters:(string * string) -> int64 -> string -> string RPC_core.t
val operation_status : string -> status option RPC_core.t
val inject : unit -> unit RPC_core.t
include RPC_core.CALLERS with type uri_provider := t
val call : ?rpc_hooks:RPC_core.rpc_hooks -> ?log_request:bool -> ?log_response_status:bool -> ?log_response_body:bool -> ?log_response_body_max:int option -> t -> '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.

If log_response_body_max is Some n, at most n bytes of the body are logged, then a truncation line. None means no limit. Default is Some 4096.

val call_raw : ?rpc_hooks:RPC_core.rpc_hooks -> ?log_request:bool -> ?log_response_status:bool -> ?log_response_body:bool -> ?log_response_body_max:int option -> ?extra_headers:(string * string) list -> t -> '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 -> ?log_response_body_max:int option -> t -> '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.