Try to read request body
[?]
Dec 18, 2018, 7:37 PM
UCY2DO3DQ2WE55CVVJYMHINBWCZYPCSZ5Q2EHMZNNZIU5LPCJNSACDependencies
- [2]
MOXHYSQ3Use more common error type\n\nMove to failure::Error after https://github.com/rust-lang-nursery/failure/pull/283 landed. - [3]
X6L47BHQUse different structure for established xmpp connection - [4]
EOHEZXX3Move request processing to structure - [*]
FVVPKFTLInitial commit
Change contents
- replacement in src/main.rs at line 27
use tokio::prelude::{Future, Sink};use tokio::prelude::{Future, Sink, Stream}; - replacement in src/main.rs at line 45
type Error = Box<dyn std::error::Error + Sync + Send>;type Future = Box<dyn Future<Item = Response<Self::ResBody>, Error = Self::Error> + Send>;type Error = Box<dyn std::error::Error + Sync + Send + 'static>;type Future = Box<dyn Future<Item = Response<Self::ResBody>, Error = Self::Error> + Send + 'static>; - replacement in src/main.rs at line 66
.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Sync + Send>),)) as Box<Future<Item = _, Error = _> + Send>.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Sync + Send + 'static>),)) as Box<Future<Item = _, Error = _> + Send + 'static> - replacement in src/main.rs at line 70
info!("Got request");info!("Got request. Reading body..."); - replacement in src/main.rs at line 72
self.cmd_send.clone().send(XmppCommand { xmpp_to }).then(|r| match r {Ok(_) => {tokio::prelude::future::ok(Response::new(Body::from("Accepted")))}Err(e) => {error!("Command sent error: {}", e);tokio::prelude::future::result(Response::builder().status(hyper::StatusCode::BAD_REQUEST).body(Body::from(format!("Command sent error: {}", e))),)}/*req.into_body().map_err(|e| Box::new(e) as Box<dyn std::error::Error + Sync + Send + 'static>).fold(String::new(), |acc, ch| {std::str::from_utf8(&*ch).map(|s| {acc.push_str(s);acc}) - replacement in src/main.rs at line 80
.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Sync + Send>),) as Box<Future<Item = _, Error = _> + Send>.and_then(|msg: String| {*/self.cmd_send.clone().send(XmppCommand { xmpp_to }).then(|r| match r {Ok(_) => tokio::prelude::future::ok(Response::new(Body::from("Accepted",))),Err(e) => {error!("Command sent error: {}", e);tokio::prelude::future::result(Response::builder().status(hyper::StatusCode::BAD_REQUEST).body(Body::from(format!("Command sent error: {}",e))),)}}).map_err(|e| {Box::new(e) as Box<dyn std::error::Error + Sync + Send + 'static>})// }),) as Box<Future<Item = _, Error = _> + Send + 'static> - replacement in src/main.rs at line 117
type Error = Box<dyn std::error::Error + Sync + Send>;type Error = Box<dyn std::error::Error + Sync + Send + 'static>;