Function casper_json_rpc::route

source ·
pub fn route<P: AsRef<str>>(
    path: P,
    max_body_bytes: u32,
    handlers: RequestHandlers,
    allow_unknown_fields: bool
) -> BoxedFilter<(impl Reply,)>
Expand description

Constructs a set of warp filters suitable for use in a JSON-RPC server.

path specifies the exact HTTP path for JSON-RPC requests, e.g. “rpc” will match requests on exactly “/rpc”, and not “/rpc/other”.

max_body_bytes sets an upper limit for the number of bytes in the HTTP request body. For further details, see warp::filters::body::content_length_limit.

handlers is the map of functions to which incoming requests will be dispatched. These are keyed by the JSON-RPC request’s “method”.

If allow_unknown_fields is false, requests with unknown fields will cause the server to respond with an error.

For further details, see the docs for the filters functions.