mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 11:59:48 -05:00
feat(server): redirect index to project homepage
This commit is contained in:
parent
338802cc9b
commit
08496cb41b
2 changed files with 7 additions and 2 deletions
|
@ -4,6 +4,8 @@ version = "0.1.0"
|
|||
edition = "2018"
|
||||
description = "A minimal file upload/pastebin service"
|
||||
authors = ["Orhun Parmaksız <orhunparmaksiz@gmail.com>"]
|
||||
homepage = "https://github.com/orhun/rustypaste"
|
||||
repository = "https://github.com/orhun/rustypaste"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "3.3.2"
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue