浏览代码

take @seanmonstar's feedback into account :heart:

Steve Klabnik 10 年之前
父节点
当前提交
c6606f0355
共有 1 个文件被更改,包括 1 次插入5 次删除
  1. 1 5
      frameworks/Rust/hyper/src/main.rs

+ 1 - 5
frameworks/Rust/hyper/src/main.rs

@@ -13,16 +13,12 @@ fn main() {
     Server::http(|req: Request, mut res: Response| {
     Server::http(|req: Request, mut res: Response| {
         match (req.method, req.uri) {
         match (req.method, req.uri) {
             (hyper::Get, RequestUri::AbsolutePath(ref path)) if path == "/plaintext" => {
             (hyper::Get, RequestUri::AbsolutePath(ref path)) if path == "/plaintext" => {
-                res.headers_mut().set(ContentLength(HELLO_WORLD.len() as u64));
                 res.headers_mut().set(ContentType::plaintext());
                 res.headers_mut().set(ContentType::plaintext());
                 res.headers_mut().set(header::Server("Hyper".to_owned()));
                 res.headers_mut().set(header::Server("Hyper".to_owned()));
 
 
                 res.send(HELLO_WORLD).unwrap();
                 res.send(HELLO_WORLD).unwrap();
-
-                StatusCode::Ok
             }
             }
-            (hyper::Get, _) => StatusCode::NotFound,
-            _ => StatusCode::MethodNotAllowed,
+            _ => (),
         };
         };
     }).listen("0.0.0.0:8080").unwrap();
     }).listen("0.0.0.0:8080").unwrap();
 }
 }