Refactor and clean up.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
use tide::{Request, Response};
 | 
			
		||||
use tide::{http::StatusCode, Request, Response};
 | 
			
		||||
 | 
			
		||||
#[async_std::main]
 | 
			
		||||
async fn main() -> tide::Result<()> {
 | 
			
		||||
@@ -14,7 +14,7 @@ async fn app_setup() -> tide::Server<()> {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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>
 | 
			
		||||
<html>
 | 
			
		||||
    <body>
 | 
			
		||||
@@ -36,6 +36,6 @@ mod basic_tests {
 | 
			
		||||
    async fn home_page_available() {
 | 
			
		||||
        let app = app_setup().await;
 | 
			
		||||
        let response = app.get("/").await.unwrap();
 | 
			
		||||
        assert_eq!(response.status(), tide::http::StatusCode::Ok);
 | 
			
		||||
        assert_eq!(response.status(), StatusCode::Ok);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user