Refactor and clean up.

This commit is contained in:
Jeff Baskin 2022-06-02 13:14:14 -04:00
parent 365133a10d
commit 015edc13c1

View File

@ -1,4 +1,4 @@
use tide::{Request, Response}; use tide::{http::StatusCode, Request, Response};
#[async_std::main] #[async_std::main]
async fn main() -> tide::Result<()> { async fn main() -> tide::Result<()> {
@ -14,7 +14,7 @@ async fn app_setup() -> tide::Server<()> {
} }
async fn home(_req: Request<()>) -> tide::Result { async fn home(_req: Request<()>) -> tide::Result {
let mut res = Response::new(200); let mut res = Response::new(StatusCode::Ok);
res.set_body("<!DOCTYPE html> res.set_body("<!DOCTYPE html>
<html> <html>
<body> <body>
@ -36,6 +36,6 @@ mod basic_tests {
async fn home_page_available() { async fn home_page_available() {
let app = app_setup().await; let app = app_setup().await;
let response = app.get("/").await.unwrap(); let response = app.get("/").await.unwrap();
assert_eq!(response.status(), tide::http::StatusCode::Ok); assert_eq!(response.status(), StatusCode::Ok);
} }
} }