Update jsonrpc dependencies and rewrite dapps to futures. (#6522)
* Bump version. * Fix RPC crate. * Fix BoxFuture in crates. * Compiles and passes tests! * Get rid of .boxed() * Fixing issues with the UI. * Remove minihttp. Support threads. * Reimplement files serving to do it in chunks. * Increase chunk size. * Remove some unecessary copying. * Fix tests. * Fix stratum warning and ipfs todo. * Switch to proper branch of jsonrpc. * Update Cargo.lock. * Update docs. * Include dapps-glue in workspace. * fixed merge artifacts * Fix test compilation.
This commit is contained in:
committed by
Arkadiy Paronyan
parent
492da38d67
commit
e8b418ca03
@@ -18,7 +18,7 @@ use devtools::http_client;
|
||||
use jsonrpc_core::MetaIoHandler;
|
||||
use http::{self, hyper};
|
||||
|
||||
use {HttpSettings, HttpServer};
|
||||
use {HttpServer};
|
||||
use tests::helpers::Server;
|
||||
use v1::{extractors, Metadata};
|
||||
|
||||
@@ -33,11 +33,13 @@ fn serve(handler: Option<MetaIoHandler<Metadata>>) -> Server<HttpServer> {
|
||||
handler,
|
||||
remote,
|
||||
extractors::RpcExtractor,
|
||||
HttpSettings::Dapps(Some(|_req: &hyper::server::Request<hyper::net::HttpStream>, _control: &hyper::Control| {
|
||||
Some(|request: hyper::Request| {
|
||||
http::RequestMiddlewareAction::Proceed {
|
||||
should_continue_on_invalid_cors: false
|
||||
should_continue_on_invalid_cors: false,
|
||||
request,
|
||||
}
|
||||
})),
|
||||
}),
|
||||
1,
|
||||
).unwrap())
|
||||
}
|
||||
|
||||
@@ -49,14 +51,13 @@ fn request(server: Server<HttpServer>, request: &str) -> http_client::Response {
|
||||
#[cfg(test)]
|
||||
mod testsing {
|
||||
use jsonrpc_core::{MetaIoHandler, Value};
|
||||
use jsonrpc_core::futures::{Future, future};
|
||||
use v1::Metadata;
|
||||
use super::{request, Server};
|
||||
|
||||
fn serve() -> (Server<::HttpServer>, ::std::net::SocketAddr) {
|
||||
let mut io = MetaIoHandler::default();
|
||||
io.add_method_with_meta("hello", |_, meta: Metadata| {
|
||||
future::ok(Value::String(format!("{}", meta.origin))).boxed()
|
||||
Ok(Value::String(format!("{}", meta.origin)))
|
||||
});
|
||||
let server = super::serve(Some(io));
|
||||
let address = server.server.address().to_owned();
|
||||
|
||||
Reference in New Issue
Block a user