mirror of https://github.com/rwf2/Rocket.git
Clean code, remove unnecessary variable req_res
This commit is contained in:
parent
944736208e
commit
6f2302c3c7
|
@ -50,16 +50,17 @@ impl hyper::Handler for Rocket {
|
||||||
let (h_addr, h_method, h_headers, h_uri, _, h_body) = hyp_req.deconstruct();
|
let (h_addr, h_method, h_headers, h_uri, _, h_body) = hyp_req.deconstruct();
|
||||||
|
|
||||||
// Convert the Hyper request into a Rocket request.
|
// Convert the Hyper request into a Rocket request.
|
||||||
let req_res = Request::from_hyp(self, h_method, h_headers, h_uri, h_addr);
|
let mut req =
|
||||||
let mut req = match req_res {
|
match Request::from_hyp(self, h_method, h_headers, h_uri, h_addr) {
|
||||||
Ok(req) => req,
|
Ok(req) => req,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Bad incoming request: {}", e);
|
error!("Bad incoming request: {}", e);
|
||||||
let dummy = Request::new(self, Method::Get, URI::new("<unknown>"));
|
let dummy =
|
||||||
let r = self.handle_error(Status::InternalServerError, &dummy);
|
Request::new(self, Method::Get, URI::new("<unknown>"));
|
||||||
return self.issue_response(r, res);
|
let r = self.handle_error(Status::InternalServerError, &dummy);
|
||||||
}
|
return self.issue_response(r, res);
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Retrieve the data from the hyper body.
|
// Retrieve the data from the hyper body.
|
||||||
let data = match Data::from_hyp(h_body) {
|
let data = match Data::from_hyp(h_body) {
|
||||||
|
|
Loading…
Reference in New Issue