From 7fe14a8e187289296e2cab98e16ab1df1af4fee4 Mon Sep 17 00:00:00 2001 From: Avril Date: Thu, 8 Oct 2020 08:19:05 +0100 Subject: [PATCH] empty body --- src/main.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index d376aea..0625ee9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,6 @@ use warp::{ Filter, Buf, reply::Response, - http, }; use hyper::Body; use std::{ @@ -30,6 +29,12 @@ use tokio::{ }; use cfg_if::cfg_if; +macro_rules! status { + ($code:expr) => { + ::warp::http::status::StatusCode::from_u16($code).unwrap() + }; +} + #[cfg(feature="trust-x-forwarded-for")] mod forwarded_list; #[cfg(feature="trust-x-forwarded-for")] @@ -131,14 +136,10 @@ async fn main() { .and_then(|chain: Arc>>, host: IpAddr, buf| { async move { full_body(&host, chain, buf).await - .map(|x| format!("{} bytes fed", x)) + .map(|_| warp::reply::with_status(warp::reply(), status!(201))) .map_err(warp::reject::custom) } }) - .map(|x| http::Response::builder() - .status(201) - .body(x) - .unwrap()) .with(warp::log("markov::put")); let read = warp::get()