Avril 4 years ago
parent f25677f243
commit 20656ce80e
Signed by: flanchan
GPG Key ID: 966FE03CC0E0B199

@ -9,6 +9,7 @@ use warp::{
Filter, Filter,
Buf, Buf,
reply::Response, reply::Response,
http,
}; };
use hyper::Body; use hyper::Body;
use std::{ use std::{
@ -133,7 +134,12 @@ async fn main() {
.map(|x| format!("{} bytes fed", x)) .map(|x| format!("{} bytes fed", x))
.map_err(warp::reject::custom) .map_err(warp::reject::custom)
} }
}); })
.map(|x| http::Response::builder()
.status(201)
.body(x)
.unwrap())
.with(warp::log("markov::put"));
let read = warp::get() let read = warp::get()
.and(chain.clone()) .and(chain.clone())
@ -149,7 +155,8 @@ async fn main() {
Ok::<_, std::convert::Infallible>(x) Ok::<_, std::convert::Infallible>(x)
})))) }))))
} }
}); })
.with(warp::log("markov::read"));
let (addr, server) = warp::serve(push let (addr, server) = warp::serve(push
.or(read)) .or(read))

Loading…
Cancel
Save