casper-json-rpc 1.1.0

A library suitable for use as the framework for a JSON-RPC server.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
mod base_filter_with_recovery_tests;
mod main_filter_with_recovery_tests;

use serde::Deserialize;

/// The HTTP response body returned in the event of a warp rejection.
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
struct ResponseBodyOnRejection {
    message: String,
}

impl ResponseBodyOnRejection {
    async fn from_response(response: http::Response<hyper::Body>) -> Self {
        let body_bytes = hyper::body::to_bytes(response.into_body()).await.unwrap();
        serde_json::from_slice(&body_bytes).unwrap()
    }
}