|
|
@ -43,20 +43,19 @@ pub fn put(mut state: State) -> Box<HandlerFuture> {
|
|
|
|
|
|
|
|
|
|
|
|
future::ok((state, res))
|
|
|
|
future::ok((state, res))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
Err(e) => {
|
|
|
|
Err(e) => {
|
|
|
|
let err = Error::new(ErrorKind::Other, e.description());
|
|
|
|
let err = Error::new(ErrorKind::Other, e.description());
|
|
|
|
future::err((state, err.into_handler_error()))
|
|
|
|
future::err((state, err.into_handler_error()))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
Err(e) => future::err((state, e.into_handler_error())),
|
|
|
|
Err(e) => future::err((state, e.into_handler_error())),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn post(mut state: State) -> Box<HandlerFuture> {
|
|
|
|
pub fn post(mut state: State) -> Box<HandlerFuture> {
|
|
|
|
Box::new({
|
|
|
|
Box::new({
|
|
|
|
Body::take_from(&mut state).concat2().then(|body| {
|
|
|
|
Body::take_from(&mut state).concat2().then(|body| {
|
|
|
@ -86,12 +85,7 @@ pub fn post(mut state: State) -> Box<HandlerFuture> {
|
|
|
|
|
|
|
|
|
|
|
|
future::ok((state, res))
|
|
|
|
future::ok((state, res))
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
let res = create_response(
|
|
|
|
let res = create_response(&state, StatusCode::OK, mime::TEXT_PLAIN, "ERR");
|
|
|
|
&state,
|
|
|
|
|
|
|
|
StatusCode::OK,
|
|
|
|
|
|
|
|
mime::TEXT_PLAIN,
|
|
|
|
|
|
|
|
"ERR"
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
future::ok((state, res))
|
|
|
|
future::ok((state, res))
|
|
|
|
}
|
|
|
|
}
|
|
|
|