diff --git a/Cargo.toml b/Cargo.toml index d897d81..1b48a37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,8 @@ version = "0.1.0" edition = "2018" description = "A minimal file upload/pastebin service" authors = ["Orhun Parmaksız "] +homepage = "https://github.com/orhun/rustypaste" +repository = "https://github.com/orhun/rustypaste" [dependencies] actix-web = "3.3.2" diff --git a/src/server.rs b/src/server.rs index 7a5fe1c..31f413d 100644 --- a/src/server.rs +++ b/src/server.rs @@ -13,7 +13,9 @@ use std::env; /// Shows the landing page. #[get("/")] async fn index() -> impl Responder { - HttpResponse::Ok().body("oops!") + HttpResponse::Found() + .header("Location", env!("CARGO_PKG_HOMEPAGE")) + .finish() } /// Serves a file from the upload directory. @@ -89,7 +91,8 @@ mod tests { let mut app = test::init_service(App::new().service(index)).await; let req = test::TestRequest::with_header("content-type", "text/plain").to_request(); let resp = test::call_service(&mut app, req).await; - assert!(resp.status().is_success()); + assert!(resp.status().is_redirection()); + assert_eq!(http::StatusCode::FOUND, resp.status()); } #[actix_rt::test]